Package: effect
Module: Result
Extracts the success value or throws the raw failure value E.
When to use
Use when unchecked boundaries should turn failures into thrown exceptions.
Details
Success<A> returns AFailure<E> throws E directlygetOrThrowWith for a custom error objectExample (Unwrapping or throwing)
import { Result } from "effect"
console.log(Result.getOrThrow(Result.succeed(1)))
// Output: 1
// This would throw the string "error":
// Result.getOrThrow(Result.fail("error"))
See
getOrThrowWith for custom error mappinggetOrElse for a non-throwing alternativeSignature
declare const getOrThrow: <A, E>(self: Result<A, E>) => A
Since v2.0.0