From a959660f90613e1452497d653d01356ad6c758d9 Mon Sep 17 00:00:00 2001 From: Pagan Gazzard Date: Wed, 15 Apr 2015 17:13:15 +0100 Subject: [PATCH] Improve error messages reported to the user in the case of finding an empty string. --- CHANGELOG.md | 1 + src/application.coffee | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e81d628..72637ed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,3 @@ +* Improved error messages reported to the user in the case of finding an empty string. * Switched to using the dockerode pull progress mechanism. * Fixed trying to delete supervisor container when it reports an alternate tag instead of the primary tag. diff --git a/src/application.coffee b/src/application.coffee index 0b529c48..9be88cbb 100644 --- a/src/application.coffee +++ b/src/application.coffee @@ -69,7 +69,15 @@ logSystemEvent = (logType, app, error) -> message = "#{logType.humanName} '#{app.imageId}'" if error? # Report the message from the original cause to the user. - errMessage = error.cause?.json ? error.cause?.message ? error.message + errMessage = error.cause?.json + if _.isEmpty(errMessage) + errMessage = error.cause?.reason + if _.isEmpty(errMessage) + errMessage = error.cause?.message + if _.isEmpty(errMessage) + errMessage = error.message + if _.isEmpty(errMessage) + errMessage = 'Unknown cause' message += " due to '#{errMessage}'" logger.log({ message, isSystem: true }) utils.mixpanelTrack(logType.eventName, {app, error})