code: def on_error(self, headers, body):
          
          if log.isEnabledFor(logging.DEBUG):
              log.debug("received an error %s [%s]", body, headers)
          else:
              log.info("received an error %s", body)
          self.errors += 1
docs: Increment the error count. See :py:meth:`ConnectionListener.on_error`
  
          :param dict headers: headers in the message
          :param body: the message content