getErrorOrElse

infix inline fun <V, E> Result<V, E>.getErrorOrElse(transform: (V) -> E): E

Returns the error if this Result is Err, otherwise the transformation of the value.