code: public void queryError(HeadersAmp headers,
                           String to,
                           long qid,
                           Throwable exn)
      throws IOException
    {
      if (log.isLoggable(Level.FINEST)) {
        log.finest(this + " error " + exn
                  + "\n  {to:" + to + "," + headers + "}");
        
      }
      
      if (log.isLoggable(Level.FINER)) {
        log.log(Level.FINER, exn.toString(), exn);
      }
      
      try {
        JsonWriterImpl jOut = _jOut;
        jOut.init();
  
        jOut.writeStartArray();
        jOut.write("error");
  
        writeHeaders(jOut, headers);
  
        jOut.write(to);
        jOut.write(qid);
  
        ErrorAmp error = ErrorAmp.create(exn);
  
        jOut.writeStartObject();
        jOut.writeKey("code");
        jOut.writeString(error.getCode().toString());
        
        jOut.writeKey("message");
        jOut.writeString(exn.getMessage());
        
        jOut.writeKey("class");
        jOut.writeString(exn.getClass().getName());
        
        jOut.writeEndObject();
  
        jOut.writeEndArray();
  
        jOut.close();
      } catch (Throwable e) {
        log.log(Level.WARNING, e.toString(), e);
        
        throw e;
      }
    }
docs: Sends a message to a given address