- safeThrowCall<L, R>(call, onError?): Either<L, R> | {
left: {
cause: string;
stack: undefined | string;
type: "unknown-error";
} | L;
tag: "left";
}
-
Parameters
-
call: (() => Either<L, R>)
-
Optional
onError: ((error) => L)
Returns Either<L, R> | {
left: {
cause: string;
stack: undefined | string;
type: "unknown-error";
} | L;
tag: "left";
}
Executes a callback in a safe throwable environment, by catching errors and returning them in a [Either<L, R>] value.