code: public <P extends Stanza> P pollResultOrThrow() throws XMPPErrorException {
          P result = pollResult();
          if (result != null) {
              XMPPErrorException.ifHasErrorThenThrow(result);
          }
          return result;
      }
docs: Polls to see if a stanza is currently available and returns it, or
  immediately returns <tt>null</tt> if no packets are currently in the
  result queue.
  <p>
  Throws an XMPPErrorException in case the polled stanzas did contain an XMPPError.
  </p>
  
  @param <P> type of the result stanza.
  @return the next available packet.
  @throws XMPPErrorException in case an error response.