MATTR Wallet SDK React Native / Exports / Result
▸ fromThrowable<Fn
, E
>(fn
, errorFn?
): (...args
: Parameters
<Fn
>) => Result
<ReturnType
<Fn
>, E
>
Wraps a function with a try catch, creating a new function with the same
arguments but returning Ok
if successful, Err
if the function throws
Name | Type |
---|---|
Fn |
extends (...args : readonly any []) => any |
E |
E |
Name | Type | Description |
---|---|---|
fn |
Fn |
function to wrap with ok on success or err on failure |
errorFn? |
(e : unknown ) => E |
when an error is thrown, this will wrap the error result if provided |
fn
▸ (...args
): Result
<ReturnType
<Fn
>, E
>
Name | Type |
---|---|
...args |
Parameters <Fn > |
Result
<ReturnType
<Fn
>, E
>