code: protected void appendErrorIfExists(XmlStringBuilder xml, XmlEnvironment enclosingXmlEnvironment) {
          StanzaError error = getError();
          if (error != null) {
              xml.append(error.toXML(enclosingXmlEnvironment));
          }
      }
docs: Append an XMPPError is this stanza has one set.
  
  @param xml the XmlStringBuilder to append the error to.