You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0699a94
Browse filesBrowse the repository at this point in the historyBrowse files
feat(core): [Unhandled Sessions 1] Add Unhandled session state and non-terminating error flag (#5919)
* collection: Unhandled Sessions
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(core): Add Unhandled session state and pending-unhandled marker
Adds Session.State.Unhandled from the session protocol, plus a
pending-unhandled marker that survives serialization. A session carrying
the marker finalizes as Unhandled instead of Exited on end(), while
Crashed and Abnormal keep taking precedence.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref: rename pendingUnhandled to nonTerminatingUnhandledError
"Unhandled" alone is ambiguous: a native crash is also an unhandled error, it
just terminates the process and so ends the session as crashed rather than
unhandled. Name the flag after the property that actually distinguishes the two
and match the vocabulary of captureEnvelopeNonTerminating.
Also clarify that the setter only restores the flag when rebuilding a session
and must not be used to mutate a live one.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref: drop public setter for the non-terminating unhandled error flag
clone() and Session.Deserializer are both inside Session, so they can restore
the field directly. Dropping the setter keeps it off the public API surface and
makes it impossible to flip the flag on a live session without counting the
error and advancing the sequence.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref: initialize the non-terminating flag through a private constructor
Every other field is set at construction; the flag was the odd one out, assigned
afterwards. A private canonical constructor keeps construction complete without
putting the flag on the public API, which a 15-arg public overload would do.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref: prefix the non-terminating flag field with has
As a bare noun phrase the field read like it held the error rather than a
boolean, most visibly where it is passed as a constructor argument.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref: drop comments that restate the code in Session
Co-authored-by: Cursor <cursoragent@cursor.com>
* test: move Session serialization cases out of SessionTest
The round-trip case duplicated one already added to SessionSerializationTest.
Keep JSON concerns in the serialization test and leave SessionTest to state
transitions.
Co-authored-by: Cursor <cursoragent@cursor.com>
* test: remove SessionTest
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs(session): describe hasNonTerminatingUnhandledError on the field
It was the only field in Session without the one-line comment the
surrounding declarations all carry.
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs(session): capitalise the hasNonTerminatingUnhandledError comment
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref(session): drop the private canonical constructor
hasNonTerminatingUnhandledError is not final - recordNonTerminating
UnhandledError and update() both write it - so setting it through a
constructor established no invariant that a plain assignment does not.
Both call sites are inside Session, so clone() and the deserializer can
assign the field directly, which is what the deserializer already does
for unknown.
Removes the 15-parameter overload and the javadoc that existed to
justify it. The public constructor is unchanged, so sentry.api is too.
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(session): use Truth in the new session serialization tests
Also swaps assertFalse(serialize(...).contains(...)) for Truth's
doesNotContain, which reports the offending json on failure instead of
just "expected false".
The two new PreviousSessionFinalizerTest cases are left on Mockito
argThat, which needs a Boolean predicate rather than an assertion.
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(session): cover the unhandled flag through the previous-session recovery paths
Co-authored-by: Cursor <cursoragent@cursor.com>
* test(session): cover the unhandled session shape with a JSON fixture
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs(session): Clarify Unhandled state and hybrid-only recording
Co-authored-by: Cursor <cursoragent@cursor.com>
* docs(session): Reword Unhandled status javadoc
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref(session): Clear the unhandled marker for any terminal status
update() only cleared hasNonTerminatingUnhandledError for Crashed, so an ANR
arriving after a non-terminating unhandled error left the marker set on an
Abnormal session and serialized it into previous_session.json. The marker only
decides how an Ok session is finalized, so any explicit terminal status clears
it now.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ref(session): Name the terminal-status check
`status != State.Ok` stated the mechanism while the comment carried the
meaning. An isTerminal helper says it directly and reads the same in
recordNonTerminatingUnhandledError, whose javadoc already spoke of terminal
states.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Revert "ref(session): Name the terminal-status check"
This reverts commit 3347255.
* changelog
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
## Unreleased
4
4
5
+
### Features
6
+
7
+
- Add `Session.State.Unhandled` for unhandled errors that do not terminate the process ([#5919](https://github.com/getsentry/sentry-java/pull/5919))
8
+
5
9
### Fixes
6
10
7
11
- Keep dropped tombstone and ANR events dropped, instead of reporting the same app exit again at every app start ([#6002](https://github.com/getsentry/sentry-java/pull/6002))
0 commit comments