Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React ErrorBoundary] Cannot create property 'cause' on string #6167

Closed
3 tasks done
voliva opened this issue Nov 9, 2022 · 3 comments · Fixed by #6181
Closed
3 tasks done

[React ErrorBoundary] Cannot create property 'cause' on string #6167

voliva opened this issue Nov 9, 2022 · 3 comments · Fixed by #6181

Comments

@voliva
Copy link

voliva commented Nov 9, 2022

Is there an existing issue for this?

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

  1. Create a react component that throws an error which is not from an Error constructor (such as throwing a string)
  2. Wrap this component with an ErrorBoundary from sentry
  3. 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.

@AbhiPrasad
Copy link
Member

Hey thanks for writing in @voliva! We will fix this.

@AbhiPrasad
Copy link
Member

Hey @voliva this was fixed and released with the newest release https://github.com/getsentry/sentry-javascript/releases/tag/7.19.0. Thanks!

@voliva
Copy link
Author

voliva commented Nov 10, 2022

Thank you too for quickly addressing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants