getOrElse

inline fun <T> ChannelResult<T>.getOrElse(onFailure: (exception: Throwable?) -> T): T(source)

Returns the encapsulated value if the operation succeeded, or the result of onFailure function for ChannelResult.exceptionOrNull otherwise.

A shorthand for if (isSuccess) getOrNull() else onFailure(exceptionOrNull()).

See also