Failure

Functions

Link copied to clipboard
inline fun exceptionOrNull(): Throwable?

Returns the encapsulated Throwable exception if this instance represents failure or null if it is success.

Link copied to clipboard
inline fun <R> fold(onSuccess: (value: Nothing) -> R, onFailure: (exception: Throwable) -> R): R

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

Link copied to clipboard
inline fun <R : Nothing> getOrElse(onFailure: (exception: Throwable) -> R): Nothing

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

Link copied to clipboard

Returns the encapsulated value if this instance represents success or null if it is failure.

Link copied to clipboard

Returns the encapsulated value if this instance represents success or throws the encapsulated Throwable exception if it is failure.

Link copied to clipboard
inline fun <R : Any> map(block: (Nothing) -> R): KmmResult<R>

Transforms this KmmResult's success-case according to block and leaves the failure case untouched (type erasure FTW!)

Link copied to clipboard
inline fun mapFailure(block: (Throwable) -> Throwable): KmmResult<Nothing>

Transforms this KmmResult's failure-case according to block and leaves the success case untouched (type erasure FTW!)

Link copied to clipboard
inline fun unwrap(): Result<Nothing>

Returns a Result equivalent of this KmmResult

Properties

Link copied to clipboard
Link copied to clipboard

Returns true if this instance represents a failed outcome. In this case isSuccess returns false.

Link copied to clipboard

Returns true if this instance represents a successful outcome. In this case isFailure returns false.