public static < X extends Throwable > void throwOrHandle ( final X e , final Predicate < X > p , final Consumer < X > handler ) { if ( p . test ( e ) ) throw ExceptionSoftener . < RuntimeException > uncheck ( e ) ; else handler . accept ( e ) ; }
Throw the exception as upwards if the predicate holds otherwise pass to the handler