def __init__(self, errno=None, msg=None): """Wrap an errno style error. Parameters ---------- errno : int The ZMQ errno or None. If None, then ``zmq_errno()`` is called and used. msg : string Description of the error or None. """ from zmq.backend import strerror, zmq_errno if errno is None: errno = zmq_errno() if isinstance(errno, int): self.errno = errno if msg is None: self.strerror = strerror(errno) else: self.strerror = msg else: if msg is None: self.strerror = str(errno) else: self.strerror = msg
def _check_rc(rc, errno=None): """internal utility for checking zmq return condition and raising the appropriate Exception class """ if rc < 0: from zmq.backend import zmq_errno if errno is None: errno = zmq_errno() from zmq import EAGAIN, ETERM if errno == EAGAIN: raise Again(errno) elif errno == ETERM: raise ContextTerminated(errno) else: raise ZMQError(errno)
def _check_rc(rc, errno=None, error_without_errno=True): """internal utility for checking zmq return condition and raising the appropriate Exception class """ if rc == -1: if errno is None: from zmq.backend import zmq_errno errno = zmq_errno() if errno == 0 and not error_without_errno: return from zmq import EAGAIN, ETERM if errno == EINTR: raise InterruptedSystemCall(errno) elif errno == EAGAIN: raise Again(errno) elif errno == ETERM: raise ContextTerminated(errno) else: raise ZMQError(errno)