util: fix wrong usage of Error.prepareStackTrace · nodejs/node@2948e96 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Commit 2948e96

szuendaddaleax

authored and

committed

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#96PR-URL: #27250Reviewed-By: Ben Noordhuis info@bnoordhuis.nl Reviewed-By: Masashi Hirano shisama07@gmail.com Reviewed-By: Ruben Bridgewater ruben@bridgewater.de Reviewed-By: Gus Caplan me@gus.host Reviewed-By: Colin Ihrig cjihrig@gmail.com Reviewed-By: James M Snell jasnell@gmail.com Reviewed-By: Luigi Pinca luigipinca@gmail.com Reviewed-By: Anto Aravinth anto.aravinth.cse@gmail.com

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -347,7 +347,7 @@ function isInsideNodeModules() {
347 347 // the perf implications should be okay.
348 348 getStructuredStack = runInNewContext(`(function() {
349 349 Error.prepareStackTrace = function(err, trace) {
350 - err.stack = trace;
350 + return trace;
351 351 };
352 352 Error.stackTraceLimit = Infinity;
353 353