TaskClass.prototype.recover<U = T>(fn: (error: unknown) => U | PromiseLike<U>): TaskClass<T | U, never>
Recovers by producing a success value — the crash boundary, the Task spelling of the
one .catch() at the top of a program. Sees every rejection, bugs included; everything
downstream is settled, so E is never.
const route = (_req: Request) => Task(() => new Response('ok')); const internalError = () => new Response(null, { status: 500 }); const log = (value: unknown): void => console.debug(value); const req = new Request('https://example.com/users/7'); const reply = await route(req).recover((bug) => { log(bug); return internalError(); });
U = T