Safely call a value, function, or promise and capture exceptions as Result.
Overloads:
safeCall(promise, onErr) -> Promise<Result<T, E>>safeCall(fn, onErr) -> Result<T, E> or Promise<Result<T, E>> (if fn returns a promise)onErr is used to map thrown or rejected values into a typed error E.
a Result<T, E> or Promise<Result<T, E>> depending on the input
Safely call a value, function, or promise and capture exceptions as Result.
Overloads:
safeCall(promise, onErr) -> Promise<Result<T, E>>safeCall(fn, onErr) -> Result<T, E> or Promise<Result<T, E>> (if fn returns a promise)onErr is used to map thrown or rejected values into a typed error E.
a Result<T, E> or Promise<Result<T, E>> depending on the input
Safely call a value, function, or promise and capture exceptions as
Result.Overloads:
safeCall(promise, onErr)->Promise<Result<T, E>>safeCall(fn, onErr)->Result<T, E>orPromise<Result<T, E>>(iffnreturns a promise)onErris used to map thrown or rejected values into a typed errorE.