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: universal
loggingobservabilityerror-handlingmonitoring
Log handled incidents so they're traceable in your log aggregator
When you swallow or recover from an error, emit a structured log so the incident can be traced later in the log/monitoring stack rather than disappearing silently.
PR: hegnar-journalist-boost · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | try { await risky(); } catch { /* silently ignored */ } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | try { |
| 2 | await risky(); |
| 3 | } catch (err) { |
| 4 | logger.error('risky step failed, continuing with fallback', { err, context }); |
| 5 | } |
Explanation (EN)
Objašnjenje (HR)