Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dtils/errors.ts>withAsyncErrorRecovery

The best unofficial library of utilities for Deno applications
Go to Latest
function withAsyncErrorRecovery
import { withAsyncErrorRecovery } from "https://deno.land/x/dtils@2.4.0/errors.ts";

Call fn, returning its result, but return recoverWith if it errors. If fn doesn't return a promise, use withErrorRecovery instead

Parameters

fn: () => Promise<T>
recoverWith: O

Returns

Promise<T | O>