Handling only some errors in an Async API
What's the best way to deal with an async API where I want to catch some errors and ignore others (i.e. let the program die)?
So far I've been using the pattern below, however 1) it feels a bit verbose and unnecessary to create wrappers for the "irrelevant" errors, and 2) it doesn't cause the program to just die when an IrrelevantError occurs.
I considered just using
So far I've been using the pattern below, however 1) it feels a bit verbose and unnecessary to create wrappers for the "irrelevant" errors, and 2) it doesn't cause the program to just die when an IrrelevantError occurs.
I considered just using
Effect.promise to run the promise, then Effect.catchSomeDefect to recover from the errors I care about, however that seems like an anti-pattern (and catchSomeDefect comes with a strong health warning as well).