handling-errors-typescript
Installation
SKILL.md
Handling Errors TypeScript
When to use
- Creating new error types for a feature
- Mapping internal errors to HTTP responses
- Reviewing try/catch usage to eliminate swallowed errors
Core rules
- All errors extend
AppErrorbase class - Expected business failures: return
Result<T,E>(don't throw) - Unexpected errors (programmer errors, infra outages): throw only these
- Never swallow errors: no empty
catch, noconsole.log(e) - All
catchblocks must handle or rethrow explicitly - Error types:
BusinessError,NotFoundError,ValidationError,UnauthorizedError,ForbiddenError,ConflictError,InfrastructureError