Skip to content

Commit 259f8f8

Browse files
authored
fix: catch exceptions setting Error.stackTraceLimit (#5254)
When node is run with [--frozen-intrinsics], a `TypeError` is thrown when any intrinsic objects or their properties are modified. This occurs when attempting to set `Error.stackTraceLimit`. To avoid exiting due to an uncaught exception, catch the exception, debug log it, and continue. [--frozen-intrinsics]: https://nodejs.org/api/cli.html#--frozen-intrinsics Signed-off-by: Kevin Locke <[email protected]>
1 parent 210d658 commit 259f8f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/cli/cli.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
4242
module.paths.push(cwd(), path.resolve('node_modules'));
4343
}
4444

45-
Error.stackTraceLimit = Infinity; // configurable via --stack-trace-limit?
45+
try {
46+
Error.stackTraceLimit = Infinity; // configurable via --stack-trace-limit?
47+
} catch (err) {
48+
debug('unable to set Error.stackTraceLimit = Infinity', err);
49+
}
4650

4751
var args = mochaArgs || loadOptions(argv);
4852

0 commit comments

Comments
 (0)