aidd-error-causes

Create named, routable errors with consistent metadata in JavaScript/TypeScript.

377|33|Updated Jul 3, 2025
One-click install
npx skills add https://github.com/paralleldrive/aidd --skill aidd-error-causes
Or copy as Structured Prompt for Agentβ–Ό
Please help me install this Agent Skill.
Skill: aidd-error-causes
Source: https://github.com/paralleldrive/aidd/tree/main/ai/skills/aidd-error-causes
Command: npx skills add https://github.com/paralleldrive/aidd --skill aidd-error-causes

SYSTEM DOCUMENTATION & REQUIREMENTS

πŸ’‘ This Skill requires error-causes, and includes scripts (resource) components.

What problem does it solve?

This Skill streamlines error handling in JavaScript/TypeScript by replacing raw errors with structured, named errors, which improves consistency and enable automatic error routing.

Core Features & Use Cases

  • Structured Error Handling: Replace raw new Error() with named, routable errors.
  • Cross-Memory Realm Compatibility: Works across memory realms (unlike instanceof).
  • Consistent Metadata: Provides consistent error metadata (name, code, message, cause).
  • Error Routing: Enables automatic error routing by name.
  • Use Case: Ideal for APIs or applications that require explicit error handling and consistent error information.

Quick Start

Start by importing the necessary functions and throw structured errors using createError.

Frequently Asked Questions about aidd-error-causes

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

FAQPage Schema
How do I handle structured errors in JavaScript APIs instead of using raw Error objects?β–Ό

Structured error handling in JavaScript replaces raw `new Error()` with named, routable errors using `createError`. This provides consistent error metadata including name, code, message, and cause, enabling automatic error routing for APIs.

Why does instanceof fail for error handling across memory realms in TypeScript?β–Ό

Error handling across memory realms fails with `instanceof` because object prototypes do not cross realm boundaries. Using structured, named errors bypasses this limitation by routing errors via name rather than prototype chain checks.

Do I need the error-causes library to use structured error handling in TypeScript?β–Ό

Yes, the `error-causes` library must be available as a dependency to use this structured error handling Skill. It provides the underlying `createError` functionality needed to replace raw errors.

What is the best way to route errors automatically by name in JavaScript applications?β–Ό

The best way to route errors automatically is by replacing `new Error()` with structured, named errors. This allows your application to identify and route errors by their specific name instead of parsing error message strings.

Can I use structured error handling to provide consistent error metadata for API development?β–Ό

Yes, structured error handling is ideal for API development requiring explicit error information. It ensures consistent metadata by providing a standard structure containing name, code, message, and cause for every error thrown.