private void throwFirstAsIOExceptions(final Collection<Throwable> exceptions) throws IOException {
        final Optional<IOException> firstException = exceptions.stream()
                .map(e -> {
                    LOGGER.error(e.getMessage(), e);

                    if (e instanceof IOException) {
                        return (IOException) e;
                    }

                    return new IOException(e.getMessage(), e);
                })
                .findFirst();
        if (firstException.isPresent()) {
            throw firstException.get();
        }
    }
Given a collection of exceptions accumulated during a process, converts/casts them all to IOExceptions,
logging them all, it then throws the first one, if any have been seen.
If no exceptions were seen, this function will simply return.

@param exceptions The list of throwables accumulated during a process.
@throws IOException If there are any throwables, the first one is thrown as an IOException.
stroom-pipeline/src/main/java/stroom/pipeline/destination/RollingDestination.java