Repository navigation
Commit 3eadc17
refactor(api): improve error handling consistency (#529)
## Summary
Improves API error handling consistency by using specific error types
instead of generic errors throughout the codebase. This provides better
error context and enables more appropriate error handling strategies.
### Key Changes
- **Use specific error types**: Replace generic `Error` throws with
`ApiValidationError`, `ApiNotFoundError`, etc. for better error
categorization
- **Add contextual comments**: Document common error scenarios (HTML
responses, multi-project access) to help future maintainers
- **Refactor agent tool utils**: Extract error handling logic into
dedicated `handleAgentToolError` function for better maintainability
- **Remove redundant tests**: Consolidated error testing (removed 464
lines of test code that was redundant)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent b18c783 commit 3eadc17
14 files changed
Lines changed: 148 additions & 575 deletions
File tree
- packages
- mcp-cloudflare/src/server/lib
- mcp-server-evals/src/evals
- mcp-server/src
- api-client
- internal
- agents/tools
- tools/search-issues
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
182 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
Lines changed: 8 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 53 | + | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 67 | + | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
| |||
83 | 80 | | |
84 | 81 | | |
85 | 82 | | |
86 | | - | |
87 | | - | |
88 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
89 | 86 | | |
90 | | - | |
| 87 | + | |
91 | 88 | | |
92 | 89 | | |
93 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
282 | 288 | | |
283 | 289 | | |
284 | 290 | | |
285 | | - | |
| 291 | + | |
| 292 | + | |
286 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
287 | 297 | | |
288 | 298 | | |
289 | 299 | | |
| |||
311 | 321 | | |
312 | 322 | | |
313 | 323 | | |
314 | | - | |
315 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
316 | 330 | | |
317 | 331 | | |
318 | 332 | | |
| |||
344 | 358 | | |
345 | 359 | | |
346 | 360 | | |
| 361 | + | |
347 | 362 | | |
348 | 363 | | |
349 | 364 | | |
| |||
359 | 374 | | |
360 | 375 | | |
361 | 376 | | |
| 377 | + | |
362 | 378 | | |
363 | 379 | | |
364 | 380 | | |
| |||
1226 | 1242 | | |
1227 | 1243 | | |
1228 | 1244 | | |
1229 | | - | |
| 1245 | + | |
1230 | 1246 | | |
1231 | 1247 | | |
1232 | 1248 | | |
1233 | 1249 | | |
1234 | | - | |
| 1250 | + | |
1235 | 1251 | | |
1236 | 1252 | | |
1237 | 1253 | | |
| |||
1361 | 1377 | | |
1362 | 1378 | | |
1363 | 1379 | | |
1364 | | - | |
| 1380 | + | |
1365 | 1381 | | |
1366 | 1382 | | |
1367 | 1383 | | |
1368 | 1384 | | |
1369 | | - | |
| 1385 | + | |
1370 | 1386 | | |
1371 | 1387 | | |
1372 | 1388 | | |
| |||
1561 | 1577 | | |
1562 | 1578 | | |
1563 | 1579 | | |
1564 | | - | |
| 1580 | + | |
1565 | 1581 | | |
1566 | 1582 | | |
1567 | 1583 | | |
| |||
1770 | 1786 | | |
1771 | 1787 | | |
1772 | 1788 | | |
1773 | | - | |
| 1789 | + | |
1774 | 1790 | | |
1775 | 1791 | | |
1776 | 1792 | | |
1777 | 1793 | | |
1778 | | - | |
| 1794 | + | |
1779 | 1795 | | |
1780 | 1796 | | |
1781 | 1797 | | |
| |||
1844 | 1860 | | |
1845 | 1861 | | |
1846 | 1862 | | |
1847 | | - | |
| 1863 | + | |
1848 | 1864 | | |
1849 | 1865 | | |
1850 | 1866 | | |
1851 | 1867 | | |
1852 | | - | |
| 1868 | + | |
1853 | 1869 | | |
1854 | 1870 | | |
1855 | 1871 | | |
| |||
0 commit comments