-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(react): Allow for scope to be accessed before error #2753
Conversation
1a095bf
to
43eb8c7
Compare
size-limit report
|
packages/react/src/errorboundary.tsx
Outdated
@@ -38,6 +38,8 @@ export type ErrorBoundaryProps = { | |||
onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void; | |||
/** Called on componentWillUnmount() */ | |||
onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void; | |||
/** Called before error is sent to Sentry, allows for you to add tags or context using the scope */ | |||
beforeSend?(scope: Scope, error: Error | null, componentStack: string | null): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this method differently, I don't like that we now can confuse global beforeSend
with this one since it's also works differently.
Alternative: beforeCapture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to beforeCapture
👍
Other than Daniel's comment 👍 |
43eb8c7
to
486f402
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit
Co-authored-by: Daniel Griesser <daniel.griesser.86@gmail.com>
This change allows users to update the scope before the error boundary sends an error to Sentry.
This was requested so that users can add specific tags or fingerprints before an error is sent to Sentry based on the error and componentStack.