Wrap all update errors as Errors

This commit is contained in:
Pablo Carranza Vélez 2015-10-06 14:44:38 +00:00
parent 2d891262a7
commit 6ed2fddd37
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,4 @@
* Bugfix: wrap all errors from update as Error objects - prevents image cleanup on download failures [Pablo]
* Wait 10 seconds after sending SIGTERM and before sending SIGKILL when stopping a container [petrosagg] * Wait 10 seconds after sending SIGTERM and before sending SIGKILL when stopping a container [petrosagg]
# v1.0.0 # v1.0.0

View File

@ -303,6 +303,10 @@ executeSpecialActionsAndBootConfig = (env) ->
if !_.isEmpty(bootConfigVars) if !_.isEmpty(bootConfigVars)
device.setBootConfig(bootConfigVars) device.setBootConfig(bootConfigVars)
wrapAsError = (err) ->
return err if _.isError(err)
return new Error(err.message ? err)
UPDATE_IDLE = 0 UPDATE_IDLE = 0
UPDATE_UPDATING = 1 UPDATE_UPDATING = 1
UPDATE_REQUIRED = 2 UPDATE_REQUIRED = 2
@ -448,7 +452,7 @@ application.update = update = (force) ->
.catch (err) -> .catch (err) ->
logSystemEvent(logTypes.updateAppError, app, err) logSystemEvent(logTypes.updateAppError, app, err)
throw err throw err
.catch(_.identity) .catch(wrapAsError)
.filter(_.isError) .filter(_.isError)
.then (failures) -> .then (failures) ->
throw new Error(joinErrorMessages(failures)) if failures.length > 0 throw new Error(joinErrorMessages(failures)) if failures.length > 0