Repository navigation
Commit 43777a5
docs(agents): Forbid introducing new catch Throwable (#5944)
* docs(agents): Forbid introducing new catch Throwable
Add an "Exception Handling" section to AGENTS.md telling agents to catch
the narrowest exception type the guarded code can throw, and to never add
a new catch (Throwable). The repo already has ~355 such catches in main
sources; they are legacy and should not be read as a precedent.
A broad catch swallows OutOfMemoryError, StackOverflowError, ThreadDeath
and LinkageError, and hides bugs in our own code behind a log line. The
"never crash the host app" requirement is what usually motivates these
catches, so the section points at ExceptionUtils.rethrowIfFatal as the
way to satisfy it, and calls out the two cases that need care: probing an
optional compileOnly dependency via a LinkageError subclass, and not
swallowing InterruptedException.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(agents): Drop the two related cases from Exception Handling
The LinkageError and InterruptedException notes were detail the core rule
does not need.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 32811a3 commit 43777a5
1 file changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
157 | 184 | | |
158 | 185 | | |
159 | 186 | | |
| |||
0 commit comments