error-handling

Implements typed errors, retries, and error boundaries for TypeScript, Python, and Go applications.

5|15|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill error-handling-clfigueiredo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/clfigueiredo/hermes-infra-skills/tree/main/.hermes/skills/curso-hermes/error-handling
Command: npx skills add https://github.com/clfigueiredo/hermes-infra-skills --skill error-handling-clfigueiredo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Inconsistent error handling leads to swallowed exceptions, leaked stack traces, confusing user messages, and cascading failures in production services. This Skill provides proven patterns for structuring errors as first-class values across TypeScript, Python, and Go codebases. ## Core Features & Use Cases - Typed Error Hierarchies: Define base AppError classes with codes and HTTP status mappings in TypeScript, Python, and Go, including sentinel errors and error wrapping. - API Error Envelopes: Standardize error responses as { error: { code, message } } with global handlers for Next.js, Express, and FastAPI, plus Zod validation error mapping. - Resilience Patterns: Apply retry with exponential backoff and jitter, React ErrorBoundary components, and user-facing message mapping that hides internal details. - Use Case: When building a new API endpoint, use this Skill to wrap handler logic in a global error handler that returns typed error codes to clients while logging full context server-side. ## Quick Start Ask the agent to review your API route or service module and apply the error handling patterns, adding typed error classes, a global exception handler, and retry logic where external calls are made.

Frequently Asked Questions about error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create custom error classes in TypeScript?▼

Extend a base AppError class that carries a code, HTTP statusCode, and optional details, then call Object.setPrototypeOf to fix the prototype chain for instanceof checks. Subclass it for specific cases like NotFoundError or ValidationError.

How to add a global exception handler in FastAPI?▼

Register handlers with app.exception_handler for your custom AppError type and for generic Exception. Return JSONResponse with a standard error envelope containing code and message, and log full details server-side for unexpected errors.

Should I retry failed API requests on 4xx errors?▼

No, retry logic should only retry retriable errors such as network failures and 5xx responses. Use a retryIf predicate to skip 4xx client errors, and apply exponential backoff with jitter capped at a maximum delay.

Does React ErrorBoundary catch async errors?▼

No, ErrorBoundary only catches errors during rendering, in lifecycle methods, and in constructors of child components. Async errors in event handlers or promises must be caught with try/catch and surfaced through state or a handler.

When should I use the Result pattern instead of throwing exceptions?▼

Use the Result pattern for operations where failure is expected and common, such as parsing or external calls, returning a discriminated union of ok and error values. Reserve exceptions for truly exceptional, unexpected conditions.