flat Map Failure
infix inline fun <Ok : Any, ErrorIn : Any, ErrorOut : Any> Outcome<Ok, ErrorIn>.flatMapFailure(transform: (ErrorIn) -> Outcome<Ok, ErrorOut>): Outcome<Ok, ErrorOut>
Returns a new Outcome, after applying transform to the Outcome.Failure error.
Transforms
Outcome<Ok, ErrorIn>
intoOutcome<Ok, ErrorOut>
.If the receiver Outcome is an Outcome.Success, the
Ok
is simply re-wrapped to update theError
type.This function does not provide a RaiseScope, and makes no guarantees about catching, handling, or rethrowing errors! Use tryRecover or outcomeOf within the transformation lambda for that.
Unlike mapFailure, flatMapFailure's transform lambda returns the Outcome wrapper directly instead of the monad's internal value.
Receiver
Return
Parameters
Ok
The Ok
type of Outcome.Success.
Error In
The Error
type of the receiver Outcome.
Error Out
The Error
type of the returned Outcome.