code: private String exWithQuery(String message, PrepareResult serverPrepareResult,
        ParameterHolder[] parameters) {
      if (options.dumpQueriesOnException) {
        StringBuilder sql = new StringBuilder(serverPrepareResult.getSql());
        if (serverPrepareResult.getParamCount() > 0) {
          sql.append(", parameters [");
          if (parameters.length > 0) {
            for (int i = 0; i < Math.min(parameters.length, serverPrepareResult.getParamCount());
                i++) {
              sql.append(parameters[i].toString()).append(",");
            }
            sql = new StringBuilder(sql.substring(0, sql.length() - 1));
          }
          sql.append("]");
        }
  
        if (options.maxQuerySizeToLog != 0 && sql.length() > options.maxQuerySizeToLog - 3) {
          return message
              + "\nQuery is: " + sql.substring(0, options.maxQuerySizeToLog - 3) + "..."
              + "\njava thread: " + Thread.currentThread().getName();
        } else {
          return message
              + "\nQuery is: " + sql
              + "\njava thread: " + Thread.currentThread().getName();
        }
      }
      return message;
    }
docs: Return exception message with query.
  
  @param message             current exception message
  @param serverPrepareResult prepare result
  @param parameters          query parameters
  @return exception message with query