Skip to content

Commit

Permalink
errors: fully inspect errors on exit
Browse files Browse the repository at this point in the history
This makes sure errors are fully inspected during exit. That is
important to provide as many debugging information to the user as
possible.

Signed-off-by: Ruben Bridgewater <[email protected]>

PR-URL: #33523
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
BridgeAR committed May 30, 2020
1 parent ce025d9 commit 6cc94b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const {
JSONStringify,
Map,
MathAbs,
MathMax,
NumberIsInteger,
ObjectDefineProperty,
ObjectKeys,
Expand Down Expand Up @@ -700,7 +701,11 @@ const fatalExceptionStackEnhancers = {
require('internal/tty').hasColors()) ||
defaultColors);
try {
return inspect(error, { colors });
return inspect(error, {
colors,
customInspect: false,
depth: MathMax(inspect.defaultOptions.depth, 5)
});
} catch {
return originalStack;
}
Expand Down
2 changes: 1 addition & 1 deletion test/message/assert_throws_stack.out
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
at *
at *
at *,
expected: [Object],
expected: { bar: true },
operator: 'throws'
}

0 comments on commit 6cc94b2

Please sign in to comment.