throw If
inline fun <Ok, Error> Outcome<Ok, Error>.throwIf(fallbackMessage: (Error) -> String = { "Outcome was Failure and throwIf predicate was true: $it" }, predicate: (Error) -> Boolean): Outcome<Ok, Error>
Throws if this is a Failure and predicate returns true 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 true if the error should be thrown.