Outcome
Represents the result of an operation that can either succeed with a value or fail with an error.
This sealed interface provides a robust way to handle operations that may produce a value or an error, offering a type-safe alternative to exceptions or nullable types. It includes utility functions for mapping, recovering, and folding outcomes, as well as converting to and from Result.
Parameters
T
The type of the value in a successful outcome.
See also
Inheritors
Properties
Functions
Link copied to clipboard
Link copied to clipboard
inline suspend fun <T> Outcome<T>.mapFailure(transform: suspend (Outcome.Failure) -> Outcome.Failure): Outcome<T>
Link copied to clipboard
inline suspend fun <T> Outcome<T>.recoverCatching(recoverBlock: suspend (Outcome.Failure) -> T): Outcome<T>
Recovers from a Failure by applying the recoverBlock function, catching any exceptions.