getOrThrow

fun <V, E : Throwable> Result<V, E>.getOrThrow(): V

Returns the value if this Result is Ok, otherwise throws the error.

This is functionally equivalent to getOrElse { throw it }.


infix inline fun <V, E> Result<V, E>.getOrThrow(transform: (E) -> Throwable): V

Returns the value if this Result is Ok, otherwise throws the transformation of the error to a Throwable.