tryCatch()
tryCatch<
E,A>(f,onThrow):Either<E,A>
Creates an Either by executing a function that may throw.
Type Parametersβ
E: Eβ
The error type.
A: Aβ
The success type.
Parametersβ
f: () => Aβ
The function to execute.
onThrow: (e) => Eβ
Function to transform thrown errors.
Returns: Either<E, A>β
An Either containing the result or error.
Sinceβ
2.0.0