error-handling

Create typed AppError objects with codes, context, and reporting utilities.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/vassovass/scl-v3 --skill error-handling-vassovass
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/vassovass/scl-v3/tree/main/.claude/skills/error-handling
Command: npx skills add https://github.com/vassovass/scl-v3 --skill error-handling-vassovass

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

StepLeague applications often suffer from scattered error handling, inconsistent user messages, and difficult debugging. This Skill provides a centralized, typed approach using AppError, ErrorCode, and reporting utilities to standardize error creation, propagation, and user feedback.

Core Features & Use Cases

  • AppError: Typed error objects with codes, context, cause, and a recoverable flag.

  • ErrorCode: A defined set of error codes to categorize failures (API, DB, auth, etc.).

  • normalizeError() and reportError(): Normalize unknown errors and report to logs or telemetry.

  • User feedback: Convert errors to user-friendly messages and expose an errorId for support.

  • Use cases include catching API route errors, handling UI error presentation, and returning structured errors from server endpoints.

Quick Start

  1. Throw AppError in your code with a code, message, and context.
  2. In catch blocks, normalize and report the error, then display a friendly message using toUserMessage().
  3. Include errorId and errorCode in API error responses for client-side UX and support.

Frequently Asked Questions about error-handling

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

FAQPage Schema
How do I implement centralized error handling in my application?

Centralized error handling standardizes how errors are created, logged, and reported across your codebase. Use AppError objects with defined ErrorCode values to categorize failures consistently, then normalize unknown exceptions through a common reporting layer. This ensures all errors follow the same structure, making debugging easier and user messaging consistent.

What's the best way to catch exceptions and display user-friendly messages?

Catch exceptions in your route handlers or UI components, normalize them using normalizeError(), and convert to user messages with toUserMessage(). Include the errorId and errorCode in API responses so users can reference the error when contacting support. This separates internal debugging details from the experience your users see.

How do I structure error responses from my API endpoints?

Return structured errors from endpoints by throwing AppError with a code, message, and context, then catching and reporting it. Include errorId, errorCode, and a user-friendly message in the JSON response. This gives clients consistent error data for UI handling and provides support teams with traceable error IDs for investigation.

Can I use error handling for both client and server code?

Yes, error handling applies to both client and server environments. AppError, ErrorCode, and reporting utilities work across your full stack, enabling consistent error creation and propagation whether you're handling API failures, database errors, authentication issues, or UI-layer exceptions.

What does the recoverable flag on AppError do?

The recoverable flag indicates whether an error is transient and can be retried or permanent and requires user intervention. This flag helps client code decide whether to show a retry button, display a permanent failure message, or route to an error recovery workflow based on the error's nature.

How do I debug errors with the integrated logging workflow?

AppError supports automatic errorId generation and integrated logging through reportError(), which captures the error code, message, context, and cause chain. This creates a traceable log entry tied to a unique errorId that users can provide to support, enabling quick correlation between user reports and backend logs.