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: TypeScript
drytypeserror-handling
Consolidate duplicate error-response interfaces
When several interfaces share the same error shape (message/error/statusCode), replace them with one shared ErrorResponse type and remove the duplicates.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codets
| 1 | interface CreateNicknameErrorResponse { message: string; error: string; statusCode: number; } |
| 2 | interface SignInErrorResponse { message: string; error: string; statusCode: number; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | interface ErrorResponse { message: string; error: string; statusCode: number; } |
| 2 | // reuse ErrorResponse everywhere |
Explanation (EN)
Objašnjenje (HR)