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: universal
error-handlingloggingobservability
Log errors before returning or swallowing them
Don't silently eat caught errors with an empty catch; log them (at least in development) so failures are diagnosable.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | fetch(url) |
| 2 | .then((r) => (r.ok ? r.json() : null)) |
| 3 | .catch(() => {}); // error vanishes |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | fetch(url) |
| 2 | .then((r) => (r.ok ? r.json() : null)) |
| 3 | .catch((err) => { |
| 4 | console.error('Failed to load comments', err); |
| 5 | return null; |
| 6 | }); |
Explanation (EN)
Objašnjenje (HR)