summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.]',