Repository navigation
docs(core): [Throwable Boundaries 5] Document how scope callbacks handle exceptions - #6661
Closed
runningcode wants to merge 1 commit into
Closed
runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
Scopes keeps swallowing the non-fatal exceptions of the withScope, withIsolationScope and configureScope callbacks, and rethrows fatal errors since the first PR in this stack. Document that on IScopes and the Sentry static methods, including that the failure only shows up in the debug log, and that before init the callback either runs on a no-op scope without a catch or doesn't run at all. Test both outcomes through Scopes, Sentry and ScopesAdapter. Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 18, 2026
Closed
📲 Install BuildsAndroid
|
3 of 9 tasks
Contributor
Author
|
Replaced by independent PRs against |
This file contains hidden or 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
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.
PR Stack (Throwable Boundaries)
📜 Description
withScope,withIsolationScopeandconfigureScopekeep swallowing the non-fatal exceptions their callback throws. #6657 already madeScopescallExceptionUtils.rethrowIfFatalfirst in those catches, with a comment saying why they are broad. This PR documents the behavior and tests it on every path that runs these callbacks:IScopesand theSentrystatic methods now says that:debugenabled;OutOfMemoryError, are rethrown;Sentry.init(and, for the static methods, afterSentry.close),withScopeandwithIsolationScoperun the callback on a no-op scope without catching anything, andconfigureScopedoesn't run it at all.RuntimeExceptionis swallowed, and one that throws anOutOfMemoryErrorpropagates. This is checked for all three methods throughScopes(also afterclose()), through theSentrystatic methods, and throughScopesAdapter.ScopesAdapterdelegates to theSentrystatic methods, which delegate to the currentScopes, so neither needs a catch of its own.NoOpScopesstill doesn't catch anything, so beforeSentry.inita throwing callback propagates, as it always has.💡 Motivation and Context
AGENTS.md says that user code wrapped by the SDK should let its own exceptions propagate. For these three callbacks we keep the existing swallowing instead, because changing it would break apps that rely on it. The broad catch now rethrows fatal errors, and the Javadoc tells users how to find out that their callback failed.
💚 How did you test it?
ScopesTestandSentryTest, with the new tests above, plus:sentry:javadoc.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
#skip-changelog
🤖 Generated with Claude Code