coerce To Success
infix inline fun <Ok : Any, Error : Any> Outcome<Ok, Error>.coerceToSuccess(recover: (Error) -> Ok): Outcome.Success<Ok>
Returns a new Outcome.Success, after applying recover to the Outcome.Failure error.
Transforms
Outcome<Ok, Error>
intoOutcome.Success<Ok>
.If the receiver Outcome is an Outcome.Success, 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.Success<Ok> with the transformed value.
Parameters
Ok
The Ok
type of Outcome.Success.
Error
The Error
type of the receiver Outcome.