Skip to content

Commit

Permalink
util: 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.

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]>
  • Loading branch information
szuend authored and addaleax committed Apr 18, 2019
1 parent dc8b57f commit 2948e96
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 @@ -347,7 +347,7 @@ function isInsideNodeModules() {
// the perf implications should be okay.
getStructuredStack = runInNewContext(`(function() {
Error.prepareStackTrace = function(err, trace) {
err.stack = trace;

This comment has been minimized.

Copy link
@mathiasbynens

mathiasbynens Apr 23, 2019

Contributor

For anyone following along, docs for Error.prepareStackTrace are here: https://v8.dev/docs/stack-trace-api#customizing-stack-traces

return trace;
};
Error.stackTraceLimit = Infinity;
Expand Down

0 comments on commit 2948e96

Please sign in to comment.