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

feat(react): Allow for scope to be accessed before error #2753

Merged
merged 4 commits into from Jul 20, 2020

Conversation

AbhiPrasad
Copy link
Member

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.

@getsentry-bot
Copy link
Contributor

getsentry-bot commented Jul 17, 2020

Messages
📖

@sentry/browser bundle gzip'ed minified size: (ES5: 17.2363 kB) (ES6: 16.3516 kB)

📖 ✅ TSLint passed

Generated by 🚫 dangerJS against 4231728

@github-actions
Copy link
Contributor

github-actions bot commented Jul 17, 2020

size-limit report

Path Size Loading time (3g) Running time (snapdragon) Total time
@sentry/browser - CDN Bundle (gzipped) 17.64 KB (-0.01% 🔽) 353 ms (-0.01% 🔽) 706 ms (+42.55% 🔺) 1.1 s
@sentry/browser - Webpack 18.39 KB (0%) 368 ms (0%) 702 ms (+34.2% 🔺) 1.1 s
@sentry/react - Webpack 18.39 KB (0%) 368 ms (0%) 511 ms (+14.5% 🔺) 878 ms
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 22.57 KB (0%) 452 ms (0%) 461 ms (-32.61% 🔽) 912 ms

@@ -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;
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to beforeCapture 👍

@kamilogorek
Copy link
Contributor

Other than Daniel's comment 👍

@AbhiPrasad AbhiPrasad force-pushed the abhi/feat/access-scope-react branch from 43eb8c7 to 486f402 Compare July 20, 2020 11:18
@AbhiPrasad AbhiPrasad requested a review from HazAT July 20, 2020 13:10
Copy link
Member

@HazAT HazAT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit

packages/react/src/errorboundary.tsx Outdated Show resolved Hide resolved
Co-authored-by: Daniel Griesser <daniel.griesser.86@gmail.com>
@AbhiPrasad AbhiPrasad merged commit 943e3f8 into master Jul 20, 2020
@AbhiPrasad AbhiPrasad deleted the abhi/feat/access-scope-react branch July 20, 2020 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants