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 ruleP2universalStack: any
loggingerror-handlingobservabilitycorrectness
Make error log messages reflect the actual failure source
A catch that can fire for multiple reasons shouldn't hardcode one cause in its message; describe accurately or distinguish.
PR: hegnar-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | } catch (e) { |
| 2 | logger.error('Error fetching data from Millistream'); // also fires on cache errors |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | } catch (e) { |
| 2 | logger.error('Error in Millistream fetch/cache', e); |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)