Skip to content
Browse files

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 <>
Reviewed-By: Masashi Hirano <>
Reviewed-By: Ruben Bridgewater <>
Reviewed-By: Gus Caplan <>
Reviewed-By: Colin Ihrig <>
Reviewed-By: James M Snell <>
Reviewed-By: Luigi Pinca <>
Reviewed-By: Anto Aravinth <>
  • Loading branch information...
szuend authored and addaleax committed Apr 16, 2019
1 parent dc8b57f commit 2948e96afd7fde91ec39bb5434bad93760ccfe13
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/internal/util.js
@@ -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 Apr 23, 2019


For anyone following along, docs for Error.prepareStackTrace are here:

return trace;
Error.stackTraceLimit = Infinity;

0 comments on commit 2948e96

Please sign in to comment.
You can’t perform that action at this time.