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).
backend ruleP1universalStack: node
error-handlingasynctry-catchobservability
Wrap independent async calls in separate try/catch blocks
Give each independent request its own try/catch so you can tell which one failed and handle them distinctly.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codejavascript
| 1 | try { |
| 2 | const a = await getA(); |
| 3 | const b = await getB(); |
| 4 | } catch (e) { handle(e); } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | try { var a = await getA(); } catch (e) { handleAError(e); } |
| 2 | try { var b = await getB(); } catch (e) { handleBError(e); } |
Explanation (EN)
Objašnjenje (HR)