Fix reporting errors without a "cause"

This commit is contained in:
Pagan Gazzard 2015-04-06 19:43:51 +01:00 committed by Pablo Carranza Vélez
parent 6c6f7e2af5
commit b4306e85db

View File

@ -69,7 +69,7 @@ logSystemEvent = (logType, app, err) ->
message = "#{logType.humanName} '#{app.imageId}'"
if err?
# Report the message from the original cause to the user.
errMessage = err.cause.json ? err.cause.message ? err.message
errMessage = err.cause?.json ? err.cause?.message ? err.message
message += " due to '#{errMessage}'"
logger.log({ message, isSystem: true })
utils.mixpanelTrack(logType.eventName, {app, err})