effect-ts-errors
Effect-TS Error Handling
Overview
Effect-TS provides a type-safe error channel (E in Effect<A, E, R>) that tracks potential failures. Use Tagged Errors for distinguishability and specialized combinators for handling or accumulating errors.
When to Use
- Defining custom error types for domain logic.
- Handling specific errors without catching everything.
- Validating multiple fields and collecting all failures.
When NOT to use:
- Simple
try/catchfor non-Effect code. - When error types don't need to be distinguished (use
Effect.fail(message)).
Core Pattern
Before (Generic Errors):
if (!user) throw new Error("Not found");
More from mrevanzak/effect-ts-skills
effect-ts-fundamentals
Use when implementing type-safe, composable, and testable applications using Effect-TS, specifically for service definition, dependency injection, and sequential async logic.
63effect-ts-concurrency
Use when performing parallel operations, rate limiting, or signaling between fibers in Effect-TS.
62effect-ts-resources
Use when managing resource lifecycles (DB connections, file handles, sockets) where cleanup must be guaranteed despite failures, interruptions, or potential resource leaks.
61effect-ts-anti-patterns
Use when reviewing Effect-TS code, debugging unexpected crashes, or optimizing concurrent operations.
61