From d47e9d09bf9638c3a8d57796d3368693230298bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Z=C3=BCnd?= Date: Tue, 16 Apr 2019 08:55:44 +0200 Subject: [PATCH] utils: 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. --- lib/internal/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/util.js b/lib/internal/util.js index 3524b9e1d62112..31a7de1a2163ff 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -337,7 +337,7 @@ function isInsideNodeModules() { // the perf implications should be okay. getStructuredStack = runInNewContext(`(function() { Error.prepareStackTrace = function(err, trace) { - err.stack = trace; + return trace; }; Error.stackTraceLimit = Infinity;