What problem does it solve?
This Skill helps developers replace traditional, error-prone patterns like try/catch, null checks, and if/else statements with the robust and type-safe Effect patterns, leading to more reliable and maintainable code.
Core Features & Use Cases
- Error Handling: Safely wrap synchronous code that throws or promises that reject using
Effect.try and Effect.tryPromise, mapping errors to specific tagged error types.
- Null/Undefined Management: Utilize
Option to explicitly handle the absence of values, preventing runtime errors.
- Conditional Logic: Replace complex if/else or switch statements with
Match for exhaustive and type-safe branching.
- Use Case: Refactor a legacy codebase to use Effect's error handling for all API interactions, ensuring that all potential errors are explicitly handled or propagated.
Quick Start
Use the effect-error-handling skill to refactor the provided code snippet to use Effect.tryPromise for handling potential promise rejections.