Skip to content

Allow user to choose if an error has been handled by an ErrorBoundary #14554

New issue

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

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

Already on GitHub? # to your account

Closed
HHK1 opened this issue Dec 3, 2024 · 6 comments
Closed

Allow user to choose if an error has been handled by an ErrorBoundary #14554

HHK1 opened this issue Dec 3, 2024 · 6 comments
Labels
Package: react Issues related to the Sentry React SDK

Comments

@HHK1
Copy link
Contributor

HHK1 commented Dec 3, 2024

Problem Statement

#8914 was setting errors caught by ErrorBoundaries as unhandled.
Then, #10985 was opened, asking to use the fallback property in order to decide if the error should be considered handled or not, and implemented in #10989.

I'm in a situation where I do not want to mark my errors as handled, despite using an ErrorBoundary. The reason is that it's a global error boundary, and at that point I consider that it's equivalent to a crash. I want to include that in my Sentry issues when filtering with unhandled, and I want to have it count towards the crashed sessions.

Solution Brainstorm

Modify the existing ErrorBoundary to pass an explicit handled property, defaulting to undefined.

For retro-compatibility the presence of the fallback property should be used if handled is not set, otherwise the setting should be used directly to mark the error as handled or not.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 3, 2024
@Lms24
Copy link
Member

Lms24 commented Dec 3, 2024

Hey @HHK1 thanks for writing in! This sounds reasonable to me. Are you interested in opening a PR to contribute this? If not, no worries, I can take a look. Just asking :)

@HHK1
Copy link
Contributor Author

HHK1 commented Dec 3, 2024

Interested in opening a PR. From the looks of the previous implementation, it doesn't look like much.
I'll get to it right now

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 3, 2024
@Lms24
Copy link
Member

Lms24 commented Dec 3, 2024

awesome, thanks!

@HHK1
Copy link
Contributor Author

HHK1 commented Dec 3, 2024

Initial implementation is here: #14560
I had some errors when running the linter and the test suite locally, so I'm waiting on the CI to see if it's a setup issue or something else.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 3, 2024
@Lms24
Copy link
Member

Lms24 commented Dec 4, 2024

Thanks, I'll take a look!

@HHK1
Copy link
Contributor Author

HHK1 commented Jan 20, 2025

fixed by #14560

@HHK1 HHK1 closed this as completed Jan 20, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Package: react Issues related to the Sentry React SDK
Projects
Archived in project
Development

No branches or pull requests

3 participants