private void handleException(final RefDataLoader refDataLoader, final Throwable e) {

        if (e instanceof ProcessException pe) {
            // ProcessException are a bit special, so we need to get the exception that we wrapped
            final Throwable wrappedThrowable = NullSafe.get(
                    pe.getXPathException(),
                    TransformerException::getException);
            if (wrappedThrowable != null) {
                handleException(refDataLoader, wrappedThrowable);
            } else {
                logAndCompleteProcessing(refDataLoader, Severity.ERROR, ProcessingState.FAILED, e);
            }
        } else {
            // The UIE/TTE may have been buried under a chain of runtime exceptions, so go digging for them
            if (e instanceof UncheckedInterruptedException
                || e instanceof TaskTerminatedException
                || ExceptionUtils.indexOfThrowable(e, UncheckedInterruptedException.class) >= 0
                || ExceptionUtils.indexOfThrowable(e, TaskTerminatedException.class) >= 0) {
                logAndCompleteProcessing(refDataLoader, Severity.INFO, ProcessingState.TERMINATED, e);
                throw new TaskTerminatedException();
            } else {
                logAndCompleteProcessing(refDataLoader, Severity.ERROR, ProcessingState.FAILED, e);
            }
        }
    }
Loads reference data that meets the supplied criteria into the current
reference data key, value maps.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/ReferenceDataLoadTaskHandler.java