-
Notifications
You must be signed in to change notification settings - Fork 0
Function.fromThrowable
GitHub Actions edited this page Mar 5, 2025
·
27 revisions
resultar / fromThrowable
fromThrowable<
Fn,E>(fn,errorFn?): (...args) =>Result<ReturnType<Fn>,E>
Defined in: result.ts:628
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
• Fn extends (...args) => unknown
• E
Fn
function to wrap with ok on success or err on failure
(e) => E
when an error is thrown, this will wrap the error result if provided
Function
...Parameters<Fn>
Result<ReturnType<Fn>, E>