Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP1universalStack: javascript
error-handlingretryrobustness
Catch errors on every attempt, including retries
When retrying a failing call, wrap the retry in its own error handling so a second failure doesn't go unhandled.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | try { return fetch(); } catch { return fetch(); } // retry can throw unhandled |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | try { return await fetch(); } |
| 2 | catch { |
| 3 | try { return await fetch(); } |
| 4 | catch (e) { console.error('Request failed many times: ' + e.message); } |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)