catch combinators on Effect have been renamed in v4. The general pattern: catchAll* is shortened to catch*, and the catchSome* family is replaced by catchFilter / catchCauseFilter.
Renamings
| v3 | v4 |
|---|---|
Effect.catchAll | Effect.catch |
Effect.catchAllCause | Effect.catchCause |
Effect.catchAllDefect | Effect.catchDefect |
Effect.catchTag | Effect.catchTag (unchanged) |
Effect.catchTags | Effect.catchTags (unchanged) |
Effect.catchIf | Effect.catchIf (unchanged) |
Effect.catchSome | Effect.catchFilter |
Effect.catchSomeCause | Effect.catchCauseFilter |
Effect.catchSomeDefect | Removed |
Effect.catchAll → Effect.catch
Effect.catchAllCause → Effect.catchCause
Effect.catchSome → Effect.catchFilter
In v3,catchSome took a function returning Option<Effect>. In v4, catchFilter uses the Filter module instead.
New in v4
Effect.catchReason
Catches a specificreason within a tagged error without removing the parent error from the error channel. Useful for handling nested error causes (e.g. an AiError with a reason: RateLimitError | QuotaExceededError).
Effect.catchReasons
LikecatchReason but handles multiple reason tags at once via an object of handlers.
Effect.catchEager
An optimization variant ofcatch that evaluates synchronous recovery effects immediately.
Migration Checklist
When migrating error handling code:- Replace
catchAllwithcatchin all error recovery code - Replace
catchAllCausewithcatchCausefor cause-level handling - Replace
catchSomewithcatchFilterand convertOptionlogic toFilter.fromPredicate - Update
catchSomeCausetocatchCauseFilterwith similar Filter conversion - Remove
catchSomeDefect— this combinator no longer exists - Keep
catchTag,catchTags, andcatchIf— these are unchanged
Summary
The v4 error handling changes simplify the API surface by:- Removing the
Allsuffix from the most common error recovery combinators - Replacing
Option-based partial catching withFilter-based predicates - Adding new specialized combinators for nested error handling (
catchReason,catchReasons) - Providing optimization hints for synchronous recovery (
catchEager)