summaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-09-10 08:16:12 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-09-13 11:00:01 +0200
commit08d983c3b9c8c47ad3cf2b8f8ba0ffdfcaf875f6 (patch)
treee9e003eccfe649bae4bfdb1a72559ae7760bdbe9 /lib/util.js
parent9c6f59ed3a145de489d467be886bb9c5f5c62613 (diff)
downloadnode-new-08d983c3b9c8c47ad3cf2b8f8ba0ffdfcaf875f6.tar.gz
util: fix indentationLvl when exceeding max call stack size
The inspection indentation level was not always reset to it's former value in case the maximum call stack size was exceeded. PR-URL: https://github.com/nodejs/node/pull/22787 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/util.js b/lib/util.js
index 985f455e5d..89c86cb7fd 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -880,6 +880,7 @@ function formatRaw(ctx, value, recurseTimes) {
ctx.seen.push(value);
let output;
+ const indentationLvl = ctx.indentationLvl;
try {
output = formatter(ctx, value, recurseTimes, keys);
if (skip === false) {
@@ -889,7 +890,7 @@ function formatRaw(ctx, value, recurseTimes) {
}
}
} catch (err) {
- return handleMaxCallStackSize(ctx, err, constructor, tag);
+ return handleMaxCallStackSize(ctx, err, constructor, tag, indentationLvl);
}
ctx.seen.pop();
@@ -910,9 +911,10 @@ function formatRaw(ctx, value, recurseTimes) {
return res;
}
-function handleMaxCallStackSize(ctx, err, constructor, tag) {
+function handleMaxCallStackSize(ctx, err, constructor, tag, indentationLvl) {
if (errors.isStackOverflowError(err)) {
ctx.seen.pop();
+ ctx.indentationLvl = indentationLvl;
return ctx.stylize(
`[${constructor || tag || 'Object'}: Inspection interrupted ` +
'prematurely. Maximum call stack size exceeded.]',