map Failure
infix inline fun <Ok : Any, ErrorIn : Any, ErrorOut : Any> Outcome<Ok, ErrorIn>.mapFailure(transform: (ErrorIn) -> 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 flatMapFailure, mapFailure's transform lambda returns the monad's internal value directly instead of the Outcome wrapper.
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.