throw Unless
inline fun <Ok, Error> Outcome<Ok, Error>.throwUnless(fallbackMessage: (Error) -> String = { "Outcome was Failure and throwUnless predicate was false: $it" }, predicate: (Error) -> Boolean): Outcome<Ok, Error>
Throws if this is a Failure and predicate returns false for the error. Returns the original Outcome unchanged otherwise.
Parameters
fallback Message
Produces the exception message from the error value. Only used when Error is not already a Throwable or nz.adjmunro.outcome.throwable.ThrowableWrapper — in those cases the existing exception is thrown as-is and this parameter is ignored.
predicate
Returns false if the error should be thrown.