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 ruleP0universalStack: node
error-handlingbuild-toolscicorrectness
Re-throw errors so a failing build step actually fails
When a build/CI step's subcommand fails, log and re-throw so the process exits non-zero; prefer default error handling over a custom message that risks dropping the stack trace.
PR: hegnar-zephr-components · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codets
| 1 | try { |
| 2 | runCommands(); |
| 3 | } catch (e) { |
| 4 | logger.warn('something failed'); |
| 5 | } |
| 6 | return result; // build still 'succeeds' |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | try { |
| 2 | runCommands(); |
| 3 | return result; |
| 4 | } catch (e) { |
| 5 | logger.error('something failed'); |
| 6 | throw e; // fail the build |
| 7 | } |
Explanation (EN)
Objašnjenje (HR)