Skip to content

Commit 8c0fcdc

Browse files
szuendaddaleax
authored andcommitted
util: fix wrong usage of Error.prepareStackTrace
The return value of Error.prepareStackTrace will become the result of Error.stack accesses. Setting Error.stack inside this callback relies on the fact that the magic get accessor detects the change in the middle of formatting, and is unnecessary in this instance. Refs: v8#96
1 parent 53e0f63 commit 8c0fcdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ function isInsideNodeModules() {
347347
// the perf implications should be okay.
348348
getStructuredStack = runInNewContext(`(function() {
349349
Error.prepareStackTrace = function(err, trace) {
350-
err.stack = trace;
350+
return trace;
351351
};
352352
Error.stackTraceLimit = Infinity;
353353

0 commit comments

Comments
 (0)