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 ruleP1project specificStack: node
error-handlingthird-partyabstractiondry
Wrap third-party SDK calls in your result/error wrapper inside the wrapper service
Centralize error handling for an external SDK in the wrapping service so callers do not each repeat try/catch around the same call.
PR: vinify-backend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // every caller: |
| 2 | try { await stripe.products.list(); } catch (e) { ... } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // stripe.service.ts wraps once: |
| 2 | getPlans() { return Result.process(() => this.client.products.list()); } |
Explanation (EN)
Objašnjenje (HR)