Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/fun/mod.ts>promise.catchError

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function promise.catchError
import { promise } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { catchError } = promise;

An alias for Promise.catch

Examples

Example 1

import { reject, catchError } from "./promise.ts";
import { pipe } from "./fn.ts";

const result = await pipe(
  reject(1),
  catchError(() => "Uhoh"),
); // "UhOh"

Parameters

fua: (u: unknown) => A

Returns

(ta: Promise<A>) => Promise<A>