-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
test: Add tests to demonstrate withScope
data loss for uncaught errors
#11204
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lms24
changed the title
test: Add tests to demonstrate withScope data loss
[ignore] test: Add tests to demonstrate withScope data loss
Mar 19, 2024
size-limit report 📦
|
Lms24
force-pushed
the
lms/test-withscope-error-throw
branch
from
March 21, 2024 10:39
270c6b6
to
6673bc0
Compare
Lms24
changed the title
[ignore] test: Add tests to demonstrate withScope data loss
test: Add tests to demonstrate Mar 21, 2024
withScope
data loss for uncaught errors
Lms24
requested review from
a team,
lforst and
AbhiPrasad
and removed request for
a team
March 21, 2024 12:14
lforst
approved these changes
Mar 21, 2024
cadesalaberry
pushed a commit
to cadesalaberry/sentry-javascript
that referenced
this pull request
Apr 19, 2024
…ors (getsentry#11204) This PR adds integration tests (browser and node) to demonstrate the current behavior around loosing scope data when a thrown error is caught by global handlers "outside" the lifetime of the throw origin's scope. This occurs specifically within the `withScope` API where the scope is popped if an error is caught but then the error is rethrown to be caught by handlers down the line.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds integration tests (browser and node) to demonstrate the current behavior around loosing scope data when a thrown error is caught by global handlers "outside" the lifetime of the throw origin's scope. This occurs specifically within the
withScope
API where the scope is popped if an error is caught but then the error is rethrown to be caught by handlers down the line.This behaviour was reported in #11133 and investigated across SDKs in getsentry/sentry-python#2857. For now it seems that general consensus is that this is expected behaviour.
So in an effort to be aware of the implications of this behavior (i.e. somewhat unexpected scope data loss), let's add these tests.
Side note: In the vast majority of our integration tests, we call
captureException
; Hence, we rarely test how unhandled errors caught by our global error handler instrumentations behave (or potentially differ from a manually captured error). We should capture errors more diversely in the future.