Skip to main content
Module

x/fun/promise.ts>catchError

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function catchError
import { catchError } from "https://deno.land/x/fun@v.2.0.0-alpha.11/promise.ts";

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>