Aller au contenu principal

tryCatch()

tryCatch<E, A>(f, onRejected): TaskEither<E, A>

Creates a TaskEither from a Promise that may reject.


Type Parameters

E: E

The error type.

A: A

The success type.


Parameters

f: () => Promise<A>

The async function to execute.

onRejected: (reason) => E

Function to transform rejection reason.


Returns: TaskEither<E, A>

A TaskEither containing the result or error.


Since

2.0.0