Skip to content

Commit

Permalink
utils: Fix wrong usage of Error.prepareStackTrace
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
szuend authored and hashseed committed Apr 16, 2019
1 parent 8c54ff7 commit 2af9e9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2af9e9f

Please sign in to comment.