Skip to main content
Module

x/dtils/mod.unstable.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.5.0/mod.unstable.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>