public static <T> Consumer<T> consumer(CheckedConsumer<T> consumer, Consumer<Throwable> handler) {
        return t -> {
            try {
                consumer.accept(t);
            }
            catch (Throwable e) {
                handler.accept(e);

                throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
            }
        };
    }
Wrap a {@link CheckedConsumer} in a {@link Consumer} with a custom handler for checked exceptions.
<p>
Example:
<pre><code>
Arrays.asList("a", "b").stream().forEach(Unchecked.consumer(
    s -> {
        if (s.length() > 10)
            throw new Exception("Only short strings allowed");
    },
    e -> {
        throw new IllegalStateException(e);
    }
));
</code></pre>
jOOL/src/main/java/org/jooq/lambda/Unchecked.java