Failure

data class Failure(val error: SolidError) : SolidResult<Nothing>

Constructors

Link copied to clipboard
constructor(error: SolidError)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

The error, or null on success.

Link copied to clipboard
inline fun <R> flatMap(transform: (Nothing) -> SolidResult<R>): SolidResult<R>

Chains an operation that itself returns a SolidResult, propagating a failure unchanged.

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

Collapses both variants to a single R.

Link copied to clipboard

The success value, or default on failure.

Link copied to clipboard
inline fun getOrElse(onFailure: (SolidError) -> Nothing): Nothing

The success value, or the result of onFailure applied to the error.

Link copied to clipboard

The success value, or null on failure.

Link copied to clipboard

The success value, or throws SolidResultException carrying the error (and its cause).

Link copied to clipboard
inline fun <R> map(transform: (Nothing) -> R): SolidResult<R>

Transforms the success value, propagating a failure unchanged.

Link copied to clipboard
inline fun onFailure(action: (SolidError) -> Unit): SolidResult<Nothing>

Runs action on the error and returns this result unchanged.

Link copied to clipboard
inline fun onSuccess(action: (Nothing) -> Unit): SolidResult<Nothing>

Runs action on the success value and returns this result unchanged.

Link copied to clipboard
inline fun recover(transform: (SolidError) -> Nothing): SolidResult<Nothing>

Recovers a failure to a success value; a success passes through unchanged.