Skip to content

Commit

Permalink
Be resilient to prepareStackTrace being set while parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Jul 22, 2024
1 parent 4e5530a commit 1569c7c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ function filterDebugStack(error: Error): string {
// to save bandwidth even in DEV. We'll also replay these stacks on the client so by
// stripping them early we avoid that overhead. Otherwise we'd normally just rely on
// the DevTools or framework's ignore lists to filter them out.
const prevPrepareStackTrace = Error.prepareStackTrace;
// $FlowFixMe[incompatible-type] It does accept undefined.
Error.prepareStackTrace = undefined;
let stack = error.stack;
Error.prepareStackTrace = prevPrepareStackTrace;
if (stack.startsWith('Error: react-stack-top-frame\n')) {
// V8's default formatting prefixes with the error message which we
// don't want/need.
Expand Down

0 comments on commit 1569c7c

Please sign in to comment.