From 24528aa638e34afc769bcf7993c369c77ebc02e6 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Sun, 12 Apr 2015 21:34:16 -0700 Subject: [PATCH] Be defensive on err.stack not being a string. Fixes #242. --- CHANGES.md | 2 +- bin/bunyan | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index bf45539..75c91fd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/bin/bunyan b/bin/bunyan index fbf4a8e..e4e387b 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -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;