-
Notifications
You must be signed in to change notification settings - Fork 0
Function.fromThrowableAsync
GitHub Actions edited this page Mar 5, 2025
·
27 revisions
resultar / fromThrowableAsync
fromThrowableAsync<
A
,T
,E
>(fn
,errorFn
?): (...args
) =>ResultAsync
<T
,E
>
Defined in: result-async.ts:473
Wraps a async function with a try catch, creating a new function with the same
arguments but returning Ok
if successful, Err
if the function throws
• A extends readonly any
[]
• T
• E
(...args
) => Promise
<T
>
function to wrap with ok on success or err on failure
(err
) => E
when an error is thrown, this will wrap the error result if provided
Function
a new function that returns a ResultAsync
...A
ResultAsync
<T
, E
>