public static boolean isTerminated(final Throwable e) {
        if (e == null) {
            return false;
        } else if (e instanceof final TransformerException te) {
            return isTerminated(te.getException());
        } else if (e instanceof final ProcessException pe) {
            final Throwable wrappedThrowable = NullSafe.get(
                    pe.getXPathException(),
                    TransformerException::getException);
            return isTerminated(wrappedThrowable);
        } else if (contains(e, TaskTerminatedException.class)) {
            return true;
        } else if (contains(e, InterruptedException.class)) {
            return true;
        } else if (contains(e, UncheckedInterruptedException.class)) {
            return true;
        } else if (contains(e, ClosedByInterruptException.class)) {
            return true;
        } else {
            return false;
        }
    }
@return True if e is an instance of or was caused by one of
{@link stroom.task.api.TaskTerminatedException}
{@link InterruptedException}
{@link ClosedByInterruptException}
{@link UncheckedInterruptedException}.
<p>
Similar (but more involved) functionality to {@link TaskTerminatedException#unwrap(Throwable)}
stroom-pipeline/src/main/java/stroom/pipeline/errorhandler/ProcessException.java