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
- Throw AppError in your code with a code, message, and context.
- In catch blocks, normalize and report the error, then display a friendly message using toUserMessage().
- Include errorId and errorCode in API error responses for client-side UX and support.