From herow-dev
(herow) Patterns for robust error handling in TypeScript and Python. Covers typed error hierarchies, the Result pattern, API error envelopes, React error boundaries, retries with backoff, and user-facing error messages.
How this skill is triggered — by the user, by Claude, or both
Slash command
/herow-dev:error-handlingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Consistent, robust error handling patterns for production applications.
Consistent, robust error handling patterns for production applications.
catch block must either handle, re-throw, or logFull implementations live in reference.md in this skill's directory — read it
when you need the code, then adapt to the project's conventions:
| Pattern | Use for |
|---|---|
| Typed error classes (TS) | Domain error hierarchy: AppError base with code + statusCode, subclasses per failure kind |
| Result pattern (TS) | Expected, common failures (parsing, external calls) without throw/catch flow |
| API error handler (Next.js/Express) | One handleApiError mapping AppError/ZodError/unknown → standard envelope { error: { code, message, details? } } |
| React Error Boundary | Catching render errors with a fallback UI + onError reporting |
| Python exception hierarchy | AppError base mirroring the TS shape (code, status_code) |
| FastAPI global handlers | @app.exception_handler for AppError + generic Exception (log full, return generic) |
| Retry with exponential backoff (TS) | Transient failures only — retryIf must exclude 4xx client errors; jittered, capped delay |
| User-facing messages | Code → friendly-text map; never expose stack traces or internals |
Before merging any code that touches error handling:
catch block handles, re-throws, or logs — no silent swallowing{ error: { code, message } }AppError with a code fieldErrorBoundary for rendering errorsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub judsonjuniorr/claude-config --plugin herow-dev