mapError

inline fun <T> Result<T>.mapError(transform: (Throwable) -> Throwable): Result<T>

Maps the error in a Result using the provided transform function. If the result is a failure, the error is transformed and wrapped in a new Result.

Return

Result with transformed error, or the original success result

Parameters

transform

Function to transform the error