error-handling-patterns

Implements error handling patterns including custom error classes, retry logic, and error boundaries.

3|Updated Aug 26, 2026
One-click install
npx skills add https://github.com/Fabric-Pro/fabric-oss --skill error-handling-patterns-fabric-pro
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: error-handling-patterns
Source: https://github.com/Fabric-Pro/fabric-oss/tree/main/.cursor/skills/error-handling-patterns
Command: npx skills add https://github.com/Fabric-Pro/fabric-oss --skill error-handling-patterns-fabric-pro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Applications without structured error handling crash unpredictably, expose sensitive details, and leave users with cryptic messages. This Skill provides proven patterns for catching, classifying, logging, and recovering from errors across Node.js APIs and React UIs. ## Core Features & Use Cases - Custom Error Classes: Build type-safe error hierarchies (ValidationError, NotFoundError, RateLimitError) with consistent HTTP status codes and error codes. - Retry & Resilience: Implement exponential backoff retries and circuit breakers for unstable external services. - React Error Boundaries: Catch rendering errors with fallback UIs and integrate Sentry for monitoring. - Use Case: When building an Express API, apply the centralized error middleware and async handler wrapper so every route returns consistent JSON error responses and reports exceptions to Sentry automatically. ## Quick Start Add centralized error handling with custom error classes and an Express error middleware to my API project.

Frequently Asked Questions about error-handling-patterns

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 captures statusCode, error code, and stack trace, then create specific subclasses like ValidationError or NotFoundError. This gives type-safe errors with consistent HTTP status codes across your API.

How to handle async errors in Express routes?▼

Wrap async route handlers in an asyncHandler function that forwards rejected promises to next(), or import express-async-errors to catch them automatically. Then a centralized error middleware formats all errors into consistent JSON responses.

What is the circuit breaker pattern for API calls?▼

A circuit breaker tracks failure counts and stops calling a failing service after a threshold, entering an OPEN state for a timeout period. After the timeout it allows a trial request (HALF_OPEN) to check if the service recovered.

Does React Error Boundary catch async errors?▼

No, error boundaries only catch errors during rendering, in lifecycle methods, and in constructors. Async errors in event handlers or useEffect must be caught with try/catch and stored in state to display fallback UI.

When should I use retry with exponential backoff?▼

Use exponential backoff for transient failures like network timeouts or rate-limited external API calls. Double the delay between attempts up to a maximum, and avoid retrying non-transient errors like validation failures.