code: public static QueryConstructionException fromThrowable(String message, Throwable cause) {
      return (cause instanceof QueryConstructionException && Objects.equals(message, cause.getMessage()))
                     ? (QueryConstructionException) cause
                     : new QueryConstructionException(message, cause);
    }
docs: Converts a Throwable to a QueryConstructionException with the specified detail message. If the
  Throwable is a QueryConstructionException and if the Throwable's message is identical to the
  one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
  a new QueryConstructionException with the detail message.
  
  @param cause       the Throwable to convert
  @param message the specified detail message
  
  @return a QueryConstructionException