getOrElse

inline fun <VALUE> Result<VALUE>.getOrElse(onError: (Throwable) -> VALUE): VALUE

Returns the encapsulated value if this instance represents Success or result of onError for encapsulated exception if it is Error.

If Error.error is CancellationException then this error is rethrown.