mapFailure

infix inline fun <Ok, ErrorIn, ErrorOut> Outcome<Ok, ErrorIn>.mapFailure(transform: (ErrorIn) -> ErrorOut): Outcome<Ok, ErrorOut>

Transforms Outcome<Ok, ErrorIn> into Outcome<Ok, ErrorOut> by applying transform to the Failure error.

  • Success outcomes pass through; the Ok is re-wrapped to satisfy ErrorOut.

  • Unlike flatMapFailure, transform returns a plain value — it is automatically wrapped in Failure.

  • No error handling is provided.

Parameters

transform

Converts the Failure error from ErrorIn to ErrorOut.

See also


inline fun <Ok, ErrorIn, ErrorOut> OutcomeFlow<Ok, ErrorIn>.mapFailure(crossinline transform: suspend (ErrorIn) -> ErrorOut): OutcomeFlow<Ok, ErrorOut>

Returns a new OutcomeFlow with each Failure error transformed by transform. Success outcomes pass through unaffected.

See also