getOrElse

inline fun <T : R, R> HubPayload<T>.getOrElse(onFailure: (error: ErrorPayload) -> R): R

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

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