code: private void validateQueryResults(String query, N1qlQueryResult result)
      {
          LOGGER.debug("Query output status: " + result.finalSuccess());
  
          if (!result.finalSuccess())
          {
              StringBuilder errorBuilder = new StringBuilder();
              for (JsonObject obj : result.errors())
              {
                  errorBuilder.append(obj.toString());
                  errorBuilder.append("\n");
              }
              errorBuilder.deleteCharAt(errorBuilder.length() - 1);
              String errors = errorBuilder.toString();
              LOGGER.error(errors);
              throw new KunderaException("Not able to execute query/statement:" + query + ". More details : " + errors);
          }
      }
docs: Validate query results.
  
  @param query
  the query
  @param result
  the result