core-error-handling

Replace generic TypeScript errors with core errors from @zerobias-org/types-core-js.

6|Updated Feb 20, 2025
One-click install
npx skills add https://github.com/zerobias-org/module --skill core-error-handling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: core-error-handling
Source: https://github.com/zerobias-org/module/tree/main/.claude/skills/core-error-handling
Command: npx skills add https://github.com/zerobias-org/module --skill core-error-handling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

All modules MUST use core errors from @zerobias-org/types-core-js instead of generic TypeScript Error class. This guide provides the correct constructor patterns for each error type.

Core Features & Use Cases

  • Enforces consistent error types across HTTP clients, services, and backend logic.
  • Demonstrates common error constructors (InvalidCredentialsError, UnauthorizedError, NoSuchObjectError, InvalidInputError, RateLimitExceededError, UnexpectedError) and the recommended usage patterns, including mapping to HTTP statuses.
  • Includes a starter utility pattern and testing considerations to ensure uniform error handling across a codebase.

Quick Start

Integrate core error handling by replacing generic Errors with core errors and adding a central handler that maps API responses to the appropriate core error constructors.

Frequently Asked Questions about core-error-handling

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

FAQPage Schema
How do I standardize typed error handling across TypeScript services?

Standardized typed error handling is enforced by replacing generic TypeScript Error classes with core errors from @zerobias-org/types-core-js, ensuring consistent error types across HTTP clients, services, and background workers.

How do I map custom API errors to HTTP statuses in a backend application?

Mapping custom API errors to HTTP statuses is achieved by applying specific constructor patterns like InvalidCredentialsError or UnauthorizedError within a central error handling utility that translates core errors into predictable HTTP status codes.

What is the best way to handle invalid input and rate limit exceeded errors in TypeScript?

Handling invalid input and rate limit exceeded errors requires using the specific InvalidInputError and RateLimitExceededError constructors from @zerobias-org/types-core-js to ensure predictable error mapping and uniform handling across your codebase.

Do I need a central error handling utility to manage core errors in HTTP clients?

A central error handling utility is recommended to integrate core errors across HTTP clients and backend logic, providing a starter pattern that maps API responses to appropriate core error constructors for uniform application behavior.

Why should I replace generic TypeScript Error classes with core errors?

Replacing generic TypeScript Error classes with core errors enforces consistent error types across all modules, providing standardized constructors and predictable HTTP status mappings for safer application logic.

How do I test core error handling patterns in a TypeScript project?

Testing core error handling involves verifying that specific error constructors and the central handling utility correctly map API responses to expected typed core errors, ensuring uniform error handling coverage across the codebase.