public static String getDefaultMessage(final Throwable e, final Throwable rootEx) {
        String msg = null;
        if (e != null && e.getMessage() != null) {
            msg = e.getMessage();
        } else {
            if (rootEx != null && rootEx.getMessage() != null) {
                msg = rootEx.getMessage();
            }
        }

        if (msg == null) {
            msg = "Unknown";

            // Log the exception otherwise we may never know what type of
            // exception this was.
            LOGGER.error(e.getMessage(), e);
        } else if (msg.startsWith("Incorrect key file for table")) {
            return "Unable to run query as data set too large";
        }

        return msg;
    }
Unwrap an exception and log it if required.
stroom-util/src/main/java/stroom/util/EntityServiceExceptionUtil.java