don't force message over exception but include it as description

This commit is contained in:
Brian Gough 2016-04-01 15:52:28 +01:00
parent 7bdf2ef26b
commit 24e097d263

View file

@ -14,15 +14,14 @@ module.exports = Logger =
captureException: (attributes, message, level) ->
# handle case of logger.error "message"
if typeof attributes is 'string'
attributes = {err: attributes}
attributes = {err: new Error(attributes)}
# extract any error object
error = attributes.err or attributes.error
# use our log message as the title when available
# include our log message in the error report
if not error?
error = {message: message} if typeof message is 'string'
else if message?
error.exception = error.message
error.message = message
attributes.description = message
# report the error
if error?
# capture attributes and use *_id objects as tags