Error handling
When to use
- •Introducing new error cases
- •Refactoring error messages or handling
- •Updating error serialization
Steps
- •Add or update error types in src/errors.ts.
- •Use typed errors in feature code, avoid ad-hoc strings.
- •Ensure correlation ids are included in client-facing errors.
- •Sanitize tokens and secrets in error messages.
- •Update tests in src/errors.test.ts and affected feature tests.
Checks and tests
- •Run
npm run typecheckbefore finishing. - •Run
npm test.
Notes
- •Keep error handling consistent with canonical docs.