Skip to content

Commit 2948e96

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 PR-URL: #27250 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Masashi Hirano <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
1 parent dc8b57f commit 2948e96

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/util.js

+1-1
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)