File tree Expand file tree Collapse file tree
sentry/src/main/java/io/sentry Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ public boolean hasNonTerminatingUnhandledError() {
224224 @ ApiStatus .Internal
225225 public boolean recordNonTerminatingUnhandledError () {
226226 try (final @ NotNull ISentryLifecycleToken ignored = sessionLock .acquire ()) {
227- if (status != State . Ok ) {
227+ if (isTerminal ( status ) ) {
228228 return false ;
229229 }
230230 hasNonTerminatingUnhandledError = true ;
@@ -310,9 +310,9 @@ public boolean update(
310310 boolean sessionHasBeenUpdated = false ;
311311 if (status != null ) {
312312 this .status = status ;
313- // the flag only decides how an Ok session is finalized, so an explicit terminal status
314- // such as a crash or an ANR takes precedence over a non-terminating error.
315- if (status != State . Ok ) {
313+ // the marker only decides how an Ok session is finalized, so a terminal status such as a
314+ // crash or an ANR takes precedence over a non-terminating error.
315+ if (isTerminal ( status ) ) {
316316 hasNonTerminatingUnhandledError = false ;
317317 }
318318 sessionHasBeenUpdated = true ;
@@ -347,6 +347,11 @@ public boolean update(
347347 }
348348 }
349349
350+ /** A session can only leave {@link State#Ok}, every other status is final. */
351+ private static boolean isTerminal (final @ NotNull State state ) {
352+ return state != State .Ok ;
353+ }
354+
350355 /**
351356 * Returns a logical clock.
352357 *
You can’t perform that action at this time.
0 commit comments