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

fix(core): Be stricter about mechanism values #4068

Merged
merged 7 commits into from
Oct 20, 2021

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Oct 15, 2021

Though we have an existing Mechanism type, we haven't actually been using it in addExceptionMechanism. As a result, I didn't catch the fact that the mechanism data I added in #4046 was malformed, and therefore being ignored by Sentry.

This fixes both of those problems (the not using of the type and the malformed data being sent). Using the correct type also allowed addExceptionMechanism to be streamlined quite a bit.

Finally, given that the question of what the different attributes and their values actually mean has come up more than once, I conferred with the team, and added a docstring to the type. Hopefully this will help anyone who needs to add mechanism data in the future.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 15, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 22.38 KB (+0.07% 🔺)
@sentry/browser - Webpack 23.26 KB (+0.11% 🔺)
@sentry/react - Webpack 23.29 KB (+0.11% 🔺)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 29.82 KB (+0.07% 🔺)

@lobsterkatie lobsterkatie force-pushed the kmclb-be-stricter-about-mechanism-values branch from d341330 to 515dd2e Compare October 18, 2021 22:17
lobsterkatie added a commit that referenced this pull request Oct 20, 2021
Extracted from #4068, to ensure that it doesn't break current behavior.
@lobsterkatie lobsterkatie force-pushed the kmclb-be-stricter-about-mechanism-values branch from 515dd2e to 707eb5d Compare October 20, 2021 06:48
if (!event.exception || !event.exception.values) {
return;
}
const exceptionValue0 = event.exception.values[0];
Copy link
Member

Choose a reason for hiding this comment

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

feels weird this just updates the first exception.

Copy link
Member Author

Choose a reason for hiding this comment

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

To be fair, that's what the function it's replacing did, also (which is reflective of the fact that 99.9% of the time, there is only one exception). But it's a fair point.

That said, it's not obvious to me what the correct fix would be, because I've seen so few examples of there being multiple exceptions. Would they always be caught by the same mechanism (in which case we can just loop) or might the values be different (in which case we'd need to get more complicated and specify which one we're talking about)? TBH, I'm not even 100% sure what could ever cause there to be more than one...

In any case, happy to discuss it but am not going to block on it.

@lobsterkatie lobsterkatie merged commit d51855e into master Oct 20, 2021
@lobsterkatie lobsterkatie deleted the kmclb-be-stricter-about-mechanism-values branch October 20, 2021 16:20
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

2 participants