What problem does it solve?
This Skill provides a robust, type-safe way to handle errors in TypeScript, eliminating the need for traditional try-catch blocks and promoting a more predictable and maintainable codebase.
Core Features & Use Cases
- Errors as Values: Functions return
Error | Value unions, making error handling explicit and compile-time checked.
- Tagged Errors: Define custom, strongly-typed errors with interpolated messages and properties.
- Exhaustive Matching: Use
matchError for compile-time guaranteed handling of all possible error states.
- Use Case: When building an API, ensure that every potential error (e.g.,
NotFoundError, ValidationError, DatabaseError) is explicitly handled by the caller, preventing runtime crashes and improving reliability.
Quick Start
Use the errore skill to define a NotFoundError class and handle it when fetching a user.