MCPcopy Create free account
hub / github.com/effect-app/libs / liftThrowable

Function liftThrowable

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

Source from the content-addressed store, hash-verified

1040 *
1041 * ```ts import.meta.vitest
1042 * import { Option, Result } from "effect"
1043 *
1044 * Option.getOrThrow(Option.some(1)) // => 1
1045 *
1046 * const failure = Result.try({
1047 * try: () => Option.getOrThrow(Option.none()),
1048 * catch: (error) => (error as Error).message
1049 * })
1050 * Result.getFailure(failure).pipe(Option.getOrElse(() => "no error")) // => "getOrThrow called on a None"
1051 * ```
1052 *
1053 * @see {@link getOrThrowWith} for a custom error
1054 * @see {@link getOrElse} for a non-throwing alternative

Callers

nothing calls this directly

Calls 3

someFunction · 0.70
noneFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…