Repository navigation
docs: Allow broad catches only at SDK boundaries - #6187
Open
runningcode wants to merge 1 commit into
Open
runningcode wants to merge 1 commit into
runningcode wants to merge 1 commit into
Conversation
Inside the SDK, catch the narrowest type. Broad catches are allowed only at boundaries where the thrown types are unknowable, must call rethrowIfFatal first, and must document what happens on failure. Align BUGBOT.md with AGENTS.md so Bugbot enforces the same policy. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
📲 Install BuildsAndroid
|
runningcode
commented
Sep 29, 2026
| existing broad catches are legacy, not precedent: they hide real bugs in our own code and make it | ||
| appear that Sentry is broken. | ||
|
|
||
| A broad catch is allowed only at a boundary where we can't know what the other side throws. Two |
Contributor
Author
There was a problem hiding this comment.
I didn't explicitly list user callbacks here since I don't think we have an agreement on what to do about those here.
I would love to write, no broad exception catching on user callbacks too.
Member
There was a problem hiding this comment.
(I thought the outcome from the last roundtable was that we must catch exceptions thrown by user callbacks 😢 )
runningcode
marked this pull request as ready for review
September 29, 2026 12:27
runningcode
requested review from
0xadam-brown,
adinauer,
markushi and
romtsn
as code owners
September 29, 2026 12:27
runningcode
commented
Oct 15, 2026
| - A code comment is required saying why the catch is broad and what happens on failure (event | ||
| dropped, feature disabled, ...). | ||
| - If wrapping user code with a broad catch, documentation is **required** explaining how the user | ||
| is expected to discover that the code they wrote isn't working. Both in code and in sentry-docs. |
Contributor
Author
There was a problem hiding this comment.
for public methods this should be on the javadoc
runningcode
commented
Oct 15, 2026
| - public API entry points like `captureException` | ||
| - Android framework calls that cross into another process (`ContentResolver`, system services) | ||
|
|
||
| At a boundary: |
Contributor
Author
There was a problem hiding this comment.
In general follow the spec in sentry-docs otherwise if nothing is specified use the following guidelines:
0xadam-brown
approved these changes
Oct 15, 2026
0xadam-brown
left a comment
Member
There was a problem hiding this comment.
Nice – thanks for the updates 💯
Comment on lines
+24
to
+25
| - A broad catch that wraps user code requires documentation, both in code and in sentry-docs, | ||
| explaining how the user is expected to discover that the code they wrote isn't working. |
This branch has not been deployed
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.
📜 Description
Rewrite
AGENTS.mdandbugbot.mdto make our error handling policy more clear. Feel free to debate anything here. I just wrote what I think would make sense but we should agree on all of these as a team.💡 Motivation and Context
As discussed on our android-sdk meeting.
📝 Checklist
sendDefaultPIIis enabled.#skip-changelog
🤖 Generated with Claude Code