some refactoring...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-03-08 20:05:49 +03:00
parent 1c29da7ee7
commit 59dc0d01c5
2 changed files with 35 additions and 24 deletions

View File

@ -571,6 +571,9 @@ var FileSystemLoaderActions = actions.Actions({
method: 'loadImages',
}
})
.then(function(){
delete that.changes
})
})
}],

View File

@ -54,31 +54,39 @@ var RecoverActions = actions.Actions({
// parent actions at this point...
loadOrRecover: ['- Location/',
function(data){
var that = this
return new Promise(function(resolve, reject){
// this is the critical section, after this point we
// are doing the actual loading....
try {
this.load(data)
that.load(data)
resolve(data)
// something bad happened, clear and handle it...
} catch(err){
this.clear()
that.clear()
console.error(err)
// recover to last location...
if(this.__recover){
this.recover()
if(that.__recover){
that.recover()
reject('recovered')
// fail...
} else {
// clear the recovery data...
delete this.__recover
delete that.__recover
// fail...
throw err
//throw err
reject(err)
}
}
})
}],
// Recover from load error...