coerce To Failure
infix inline fun <Ok : Any, Error : Any> Outcome<Ok, Error>.coerceToFailure(falter: (Ok) -> Error): Outcome.Failure<Error>
Returns a new Outcome.Failure, after applying falter to the Outcome.Success value.
Transforms
Outcome<Ok, Error>
intoOutcome.Failure<Ok, Error>
.If the receiver Outcome is an Outcome.Failure, nothing happens.
This function does not provide a RaiseScope, and makes no guarantees about catching, handling, or rethrowing errors! Use outcomeOf within the transformation lambda for that.
Receiver
Return
A new Outcome.Failure<Nothing, Error> with the transformed error.
Parameters
Ok
The Ok
type of the receiver Outcome.
Error
The Error
type of Outcome.Failure.