fix(core): Only consider exception mechanism when updating session status from event with exceptions #18137
+107
−2
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 fixes an oversight in our session update logic when we update the SDK's session status while processing an error event. Previously, we'd always set
status: 'crashed'as soon as the top-levelevent.levelfield was set to'fatal'(added in #15072). However, this disregarded the case where the level was initially'fatal'but later on the SDK or users decided to set theevent.exceptions.values[i].mechanism.handledfield totrue.Simplest reproduction:
This PR changes the update logic to only look at the event mechanisms if the event contained exceptions. I think this is still compatible with #15072 because the PR suggests we only care about
event.level === 'fatal'if no exceptions are on the event. But I'd appreciate a second pair of eyes on this (cc @timfish).