getOrElse

inline fun getOrElse(onFailure: (exception: Throwable) -> @UnsafeVariance T): T(source)

Returns the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated Throwable exception if it is failure.

Note, that this function rethrows any Throwable exception thrown by onFailure function.

This function is a shorthand for fold(onSuccess = { it }, onFailure = onFailure) (see fold).