MCPcopy
hub / github.com/Effect-TS/effect / liftThrowable

Function liftThrowable

packages/effect/src/Option.ts:812–821  ·  view source on GitHub ↗
(
  f: (...a: A) => B
)

Source from the content-addressed store, hash-verified

810 * @since 2.0.0
811 */
812export const liftThrowable = <A extends ReadonlyArray<unknown>, B>(
813 f: (...a: A) => B
814): (...a: A) => Option<B> =>
815(...a) => {
816 try {
817 return some(f(...a))
818 } catch {
819 return none()
820 }
821}
822
823/**
824 * Extracts the value of an `Option` or throws an error if the `Option` is

Callers

nothing calls this directly

Calls 3

noneFunction · 0.85
someFunction · 0.70
fFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…