public <T extends Throwable> void throwIfNecessary(Function<Throwable, T> function) throws T {
        if (!throwables.isEmpty()) {
            T result = function.apply(throwables.removeFirst());
            attachToThrowable(result);
            throw result;
        }
    }
Attach all recorded exceptions to a new throwable and throw it.

@param function Returns the throwable to attach to. Only called if there are any additional throwables present. The first one present is passed into the
                function and is intended as the cause for the exception chain.
core/src/main/java/org/jdbi/v3/core/internal/exceptions/ThrowableSuppressor.java