pmmmwh / react-refresh-webpack-plugin

A Webpack plugin to enable "Fast Refresh" (also previously known as Hot Reloading) for React components.
MIT License
3.14k stars 193 forks source link

ErrorStackParser.parse can throw an error #90

Closed mgh closed 4 years ago

mgh commented 4 years ago

This line can throw, which causes an infinite set of errors.

https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/master/src/overlay/components/RuntimeErrorStack.js#L31

Caused by this line in the library https://github.com/stacktracejs/error-stack-parser/blob/master/error-stack-parser.js#L35

Not sure if this is helpful, but I have an error from the Chrome browser when a video is paused.

Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22

This error has a few properties, but stack is not one of them:

code: 20
message: "The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22"
name: "AbortError"
__proto__: DOMException

This can be fixed by catching the exception, though there may be a better way to render an error with no stack trace:

let errorStacks;
try {
  errorStacks = ErrorStackParser.parse(props.error);
} catch (e) {
  errorStacks = [];
}
pmmmwh commented 4 years ago

Good catch, thanks for the PR.