Report failures to start the container (eg bad CMD in a Dockerfile)

This commit is contained in:
Pagan Gazzard 2015-03-12 17:23:13 +00:00 committed by Pablo Carranza Vélez
parent 84b5746111
commit 7a3d5b06c2

View File

@ -143,6 +143,13 @@ exports.start = start = (app) ->
'/var/run/docker.sock:/run/docker.sock'
]
)
# Bluebird throws OperationalError for errors resulting in the normal execution of a promisified function.
.catch Promise.OperationalError, (err) ->
# Report the message from the original cause to the user.
message = err.cause.json ? err.cause.message ? err.message
logSystemEvent("Unable to start application #{app.imageId} due to:\n#{message}")
# And rethrow the error, to be handled later as necessary.
throw err
.then ->
updateDeviceState(commit: app.commit)
logger.attach(app)