From b7551e9ea4b142e71695b17d9142442fc58b4010 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 PR-URL: https://github.com/nodejs/node/pull/33523 Reviewed-By: Michaƫl Zasso Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- 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 b4a6b0858b567b..6bc376f0eb3374 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' }