error-handling

Standardize error handling with typed errors, async wrappers, and structured logging.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Dsantiagomj/DSMJ-Ai-Toolkit --skill error-handling-dsantiagomj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/Dsantiagomj/DSMJ-Ai-Toolkit/tree/main/skills/domain/error-handling
Command: npx skills add https://github.com/Dsantiagomj/DSMJ-Ai-Toolkit --skill error-handling-dsantiagomj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill standardizes and centralizes error handling patterns for APIs, UI, and services.

Core Features & Use Cases

  • Custom Error Classes: Define typed, structured errors to convey precise failure information.
  • Async Error Handling: Centralized wrappers and patterns to manage asynchronous failures.
  • React Error Boundaries: Safe render boundaries to prevent UI crashes.
  • Structured Logging: Consistent, queryable logs with contextual data.
  • Graceful Degradation: Fallback behaviors to maintain partial functionality during failures.

Quick Start

To start using this skill, identify error-handling opportunities in your API routes and UI components, implement typed errors and an async wrapper, and adopt a structured logger with request context. See references for concrete patterns and examples.

Frequently Asked Questions about error-handling

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

FAQPage Schema
How do I centralize error handling across API routes and UI components?

Structured logging captures queryable logs with contextual request data, while custom error classes convey precise failure information. Together they ensure errors are traceable and maintain partial functionality through graceful degradation fallbacks.

What is the best way to handle async errors in API services?

React error boundaries create safe render boundaries that catch UI crashes and prevent total application failure. They enable graceful degradation by displaying fallback behaviors during rendering errors, maintaining partial functionality for users.

How do I add request context to structured logs for error tracking?

This skill fits API, UI, and background job contexts by providing typed error classes, async wrappers, React error boundaries, and structured logging. It requires no external dependencies, making it adaptable across various JavaScript and React service environments.

When should I implement custom error classes instead of generic throws?

Yes, you can use React error boundaries with structured logging by integrating a structured logger within the error boundary pattern. This captures rendering errors with contextual data, providing queryable logs while displaying fallback UI behaviors.

What are the limitations of using React error boundaries for async errors?

React error boundaries do not catch errors in event handlers or async code; they only handle rendering errors. You must pair them with an async wrapper and centralized structured logging to manage asynchronous failures in API and background jobs effectively.