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 <ruben@bridgewater.de>

PR-URL: #33523
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR authored and codebytere committed Jul 8, 2020
1 parent 0f0720a commit 76b06e5
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 @@ -695,7 +696,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 76b06e5

Please sign in to comment.