Skip to content

Commit 25922d4

Browse files
ref(scope): Mark IWithSession public internal like IWithTransaction
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5452526 commit 25922d4

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,23 @@ public static SentryId captureEnvelopeNonTerminating(final @NotNull byte[] envel
251251
if (eventState != EnvelopeEventState.NONE) {
252252
scopes.configureScope(
253253
scope -> {
254-
final @Nullable Session session = scope.getSession();
255-
if (session != null) {
256-
final boolean updated =
257-
eventState == EnvelopeEventState.UNHANDLED
258-
? session.recordNonTerminatingUnhandledError()
259-
: session.update(null, null, true, null);
260-
if (updated && options.getEnvelopeDiskCache() instanceof EnvelopeCache) {
261-
((EnvelopeCache) options.getEnvelopeDiskCache()).persistCurrentSession(session);
262-
}
263-
} else {
264-
options.getLogger().log(INFO, "Session is null on captureEnvelopeNonTerminating");
265-
}
254+
scope.withSession(
255+
session -> {
256+
if (session != null) {
257+
final boolean updated =
258+
eventState == EnvelopeEventState.UNHANDLED
259+
? session.recordNonTerminatingUnhandledError()
260+
: session.update(null, null, true, null);
261+
if (updated && options.getEnvelopeDiskCache() instanceof EnvelopeCache) {
262+
((EnvelopeCache) options.getEnvelopeDiskCache())
263+
.persistCurrentSession(session);
264+
}
265+
} else {
266+
options
267+
.getLogger()
268+
.log(INFO, "Session is null on captureEnvelopeNonTerminating");
269+
}
270+
});
266271
});
267272
}
268273

sentry/api/sentry.api

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,6 +2497,10 @@ public abstract interface class io/sentry/Scope$IWithPropagationContext {
24972497
public abstract fun accept (Lio/sentry/PropagationContext;)V
24982498
}
24992499

2500+
public abstract interface class io/sentry/Scope$IWithSession {
2501+
public abstract fun accept (Lio/sentry/Session;)V
2502+
}
2503+
25002504
public abstract interface class io/sentry/Scope$IWithTransaction {
25012505
public abstract fun accept (Lio/sentry/ITransaction;)V
25022506
}

sentry/src/main/java/io/sentry/Scope.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,8 @@ public Session withSession(final @NotNull IWithSession sessionCallback) {
10181018
}
10191019

10201020
/** The IWithSession callback */
1021-
interface IWithSession {
1021+
@ApiStatus.Internal
1022+
public interface IWithSession {
10221023

10231024
/**
10241025
* The accept method of the callback

0 commit comments

Comments
 (0)