Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/react
SDK Version
7.18.0
Framework Version
18.2.0
Link to Sentry event
No response
Steps to Reproduce
- Create a react component that throws an error which is not from an Error constructor (such as throwing a string)
- Wrap this component with an ErrorBoundary from sentry
- Run it
Example codesandbox: https://codesandbox.io/s/infallible-sun-urw7yh?file=/src/App.js
Expected Result
The error should get captured and sent to Sentry as a Non-Error exception
Actual Result
The ErrorBoundary causes another error when it tries to set the property cause
onto the original one. Because it's not an Error object, but in this case a primitive type, then it throws that other error.
This exception then bubbles further up to the next ErrorBoundary, dismounting other components that shouldn't be dismounted.