Be defensive on err.stack not being a string. Fixes #242.

master
Trent Mick 2015-04-12 21:34:16 -07:00
parent 6f81f4b1e1
commit 24528aa638
2 changed files with 6 additions and 2 deletions

View File

@ -8,7 +8,7 @@ Known issues:
## bunyan 1.3.5 (not yet released)
(nothing yet)
- [issue #242] Be defensive on err.stack not being a string.
## bunyan 1.3.4

View File

@ -976,7 +976,11 @@ function emitRecord(rec, line, opts, stylize) {
if (rec.err && rec.err.stack) {
var err = rec.err
details.push(indent(err.stack));
if (typeof (err.stack) !== 'string') {
details.push(indent(err.stack.toString()));
} else {
details.push(indent(err.stack));
}
delete err.message;
delete err.name;
delete err.stack;