toErrorUnless

inline fun <V, E> Result<V, E>.toErrorUnless(predicate: (V) -> Boolean, transform: (V) -> E): Result<V, E>

Returns the transformation of the value if this Result is Ok and does not satisfy the given predicate, otherwise this Result.

See also