mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-01 23:30:48 +00:00
Prefer err.message when reporting errors from dockerode, then err.json and err.reason
Errors from docker-modem that are passed from dockerode can have a "json" or "reason" property, but that is generally less descriptive than the more standard "message", and can show up in the logs as `[object Object]`. This commit changes it so that we log err.message if it is non-empty, and otherwise look for json and reason. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
parent
a8e11b51a0
commit
dbb4fd8292
@ -130,11 +130,11 @@ logSystemEvent = (logType, app = {}, error) ->
|
|||||||
message = "#{logType.humanName} '#{app.imageId}'"
|
message = "#{logType.humanName} '#{app.imageId}'"
|
||||||
if error?
|
if error?
|
||||||
# Report the message from the original cause to the user.
|
# Report the message from the original cause to the user.
|
||||||
errMessage = error.json
|
errMessage = error.message
|
||||||
|
if _.isEmpty(errMessage)
|
||||||
|
errMessage = error.json
|
||||||
if _.isEmpty(errMessage)
|
if _.isEmpty(errMessage)
|
||||||
errMessage = error.reason
|
errMessage = error.reason
|
||||||
if _.isEmpty(errMessage)
|
|
||||||
errMessage = error.message
|
|
||||||
if _.isEmpty(errMessage)
|
if _.isEmpty(errMessage)
|
||||||
errMessage = 'Unknown cause'
|
errMessage = 'Unknown cause'
|
||||||
message += " due to '#{errMessage}'"
|
message += " due to '#{errMessage}'"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user