or

inline fun <R> AsyncResult<R>.or(other: AsyncResult<R>): AsyncResult<R>

Returns other if this is an Error, otherwise returns this unchanged.

The other result is evaluated eagerly regardless of whether this is an error. For lazy evaluation, use orElse.

Example:

val primary: AsyncResult<Int> = Error(Exception("Failed"))
val fallback: AsyncResult<Int> = Success(42)
val result = primary.or(fallback) // Success(42)

Return

This AsyncResult if successful, other if this is an error

Parameters

other

The fallback AsyncResult to use if this is an error