public static EntityServiceException create(final Throwable ex) throws EntityServiceException {
        if (ex instanceof EntityServiceException) {
            LOGGER.trace("create() - {}", ex.getMessage());

            return (EntityServiceException) ex;
        } else {
            LOGGER.debug("create() - wrapping exception", ex);

            return unwrap(ex);
        }
    }
Handle an exception and throw a nice EntityServiceException
stroom-util/src/main/java/stroom/util/EntityServiceExceptionUtil.java