-
-
Notifications
You must be signed in to change notification settings - Fork 221
Description
react-error-boundaryversion: 4.0.13nodeversion:npmversion:
Relevant code or config
import { useErrorBoundary } from "react-error-boundary";
const { showBoundary } = useErrorBoundary();
const handleClick = () => {
try {
throw "Error";
} catch (err) {
showBoundary(err);
}
}What you did: I call showBoundary on an error. In the following Codesandbox demo, click the button "Throw An Error", which calls the handleClick function above.
What happened: It generates an uncaught error in the browser console.
Reproduction repository: Codesandbox demo
Problem description: Whenever I call the showBoundary function on an error, the same error will be reproduced and thrown, and an uncaught error message will show in the console.
Suggested solution: I believe the reproduced error is generated by the code in line 39-41 in src/useErrorBoundary.ts. I am not sure what purpose these lines serve. I suggest remove them from the file. I now understand that lines 39-41 in src/useErrorBoundary.ts are crucial for the ErrorBoundary to function properly. Is there a built-in mechanism in react-error-boundary to suppress the display of uncaught error messages after calling showBoundary? If not, and if you think this would enhance the developer experience, I’d be happy to work on a solution. Thanks!