public static LongBinaryOperator longBinaryOperator(CheckedLongBinaryOperator operator, Consumer<Throwable> handler) {
        return (l1, l2) -> {
            try {
                return operator.applyAsLong(l1, l2);
            }
            catch (Throwable e) {
                handler.accept(e);

                throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
            }
        };
    }
Wrap a {@link CheckedLongBinaryOperator} in a {@link LongBinaryOperator} with a custom handler for checked exceptions.
<p>
Example:
<pre><code>
LongStream.of(1L, 2L, 3L).reduce(Unchecked.longBinaryOperator(
    (l1, l2) -> {
        if (l2 &lt; 0L)
            throw new Exception("Only positive numbers allowed");

        return l1 + l2;
    },
    e -> {
        throw new IllegalStateException(e);
    }
));
</code></pre>
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java