Skip to content

Commit

Permalink
exception message in json formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
innocentiv committed Nov 8, 2017
1 parent 7bb5a3b commit c3b1453
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/formatter/json_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,14 @@ export default class JsonFormatter extends Formatter {
data.result.duration = testStep.result.duration
}
if (status === Status.FAILED && exception) {
data.result.error_message = exception.stack || exception
if (_.isString(exception)) {
data.result.error_message = exception
} else {
let { message = '', stack = '' } = exception
message = _.includes(stack, message) ? '' : message + '\n'
data.result.error_message =
message + stack || JSON.stringify(exception)
}
}
}
if (_.size(testStep.attachments) > 0) {
Expand Down

0 comments on commit c3b1453

Please sign in to comment.