From 7d09eae99a31309a0092e245681aa8b94879bd8c Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 22 May 2020 14:18:21 +0200 Subject: [PATCH] errors: fully inspect errors on exit 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 --- lib/internal/errors.js | 7 ++++++- test/message/assert_throws_stack.out | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 56724ba53ed092..d023142a7800c1 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -16,6 +16,7 @@ const { JSONStringify, Map, MathAbs, + MathMax, NumberIsInteger, ObjectDefineProperty, ObjectKeys, @@ -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; } diff --git a/test/message/assert_throws_stack.out b/test/message/assert_throws_stack.out index e9f9cc5e891c37..a2da1f2b6c5b37 100644 --- a/test/message/assert_throws_stack.out +++ b/test/message/assert_throws_stack.out @@ -29,6 +29,6 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: at * at * at *, - expected: [Object], + expected: { bar: true }, operator: 'throws' }