common inline fun <A, B, C> Either<A, B>.handleErrorWith(f: (A) -> Either<C, B>): Either<C, B>

Applies the given function f if this is a Left, otherwise returns this if this is a Right. This is like flatMap for the exception.

common inline fun <A> Option<A>.handleErrorWith(f: (Unit) -> Option<A>): Option<A>

inline fun <E, A> Validated<E, A>.handleErrorWith(f: (E) -> Validated<E, A>): Validated<E, A>

common inline fun <A> Result<A>.handleErrorWith(transform: (throwable: Throwable) -> Result<A>): Result<A>

Compose a recovering transform operation on the failure value Throwable whilst flattening Result.

See also


recoverCatching if you want run a function that catches and maps recovers with (Throwable) -> A.

Do you like Arrow?

Arrow Org