Skip to content

Commit 7748619

Browse files
committed
fixup: add requested change
1 parent ef4e8d3 commit 7748619

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/util.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,11 +711,11 @@ function formatValue(ctx, value, recurseTimes) {
711711
} catch (err) {
712712
if (errors.isStackOverflowError(err)) {
713713
ctx.seen.pop();
714-
process.emitWarning(
715-
'Inspection reached the maximum call stack size. Incomplete ' +
716-
'inspected object returned.'
714+
return ctx.stylize(
715+
`[${constructor || tag || 'Object'}: Inspection interrupted ` +
716+
'prematurely. Maximum call stack size exceeded.]',
717+
'special'
717718
);
718-
return ctx.stylize(`[${constructor || tag || 'Object'}]`, 'special');
719719
}
720720
throw err;
721721
}

test/parallel/test-util-inspect.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,15 +1418,9 @@ util.inspect(process);
14181418
util.inspect(list),
14191419
'{ next: { next: { next: [Object] } } }'
14201420
);
1421-
common.expectWarning({
1422-
Warning: [
1423-
'Inspection reached the maximum call stack size. ' +
1424-
'Incomplete inspected object returned.',
1425-
common.noWarnCode
1426-
]
1427-
});
14281421
const longList = util.inspect(list, { depth: Infinity });
14291422
const match = longList.match(/next/g);
14301423
assert(match.length > 1000 && match.length < 10000);
1431-
assert(longList.includes('[Object]'));
1424+
assert(longList.includes('[Object: Inspection interrupted ' +
1425+
'prematurely. Maximum call stack size exceeded.]'));
14321426
}

0 commit comments

Comments
 (0)