Skip to content

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

Merged
AbhiPrasad merged 4 commits intomasterfrom
abhi/feat/access-scope-react
Jul 20, 2020
Merged

feat(react): Allow for scope to be accessed before error#2753
AbhiPrasad merged 4 commits intomasterfrom
abhi/feat/access-scope-react

Conversation

@AbhiPrasad
Copy link
Contributor

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.

@AbhiPrasad AbhiPrasad requested a review from kamilogorek as a code owner July 17, 2020 21:45
@AbhiPrasad AbhiPrasad force-pushed the abhi/feat/access-scope-react branch from 1a095bf to 43eb8c7 Compare July 17, 2020 21:46
@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

/** 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
Contributor 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

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.

4 participants