|
|
@ -60,16 +60,22 @@ class CallError(Error):
|
|
|
|
exception message.
|
|
|
|
exception message.
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
def __init__(self, e):
|
|
|
|
def __init__(self, e):
|
|
|
|
s = ''
|
|
|
|
s = '%s.%s: %s' % (type(e).__module__, type(e).__name__, e)
|
|
|
|
if not isinstance(e, basestring):
|
|
|
|
|
|
|
|
s += '%s.%s: ' % (type(e).__module__, type(e).__name__)
|
|
|
|
|
|
|
|
s += str(e)
|
|
|
|
|
|
|
|
tb = sys.exc_info()[2]
|
|
|
|
tb = sys.exc_info()[2]
|
|
|
|
if tb:
|
|
|
|
if tb:
|
|
|
|
s += '\n'
|
|
|
|
s += '\n'
|
|
|
|
s += ''.join(traceback.format_tb(tb))
|
|
|
|
s += ''.join(traceback.format_tb(tb))
|
|
|
|
Error.__init__(self, s)
|
|
|
|
Error.__init__(self, s)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __reduce__(self):
|
|
|
|
|
|
|
|
return (_unpickle_call_error, (self[0],))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _unpickle_call_error(s):
|
|
|
|
|
|
|
|
assert type(s) is str and len(s) < 10000
|
|
|
|
|
|
|
|
inst = CallError.__new__(CallError)
|
|
|
|
|
|
|
|
Exception.__init__(inst, s)
|
|
|
|
|
|
|
|
return inst
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChannelError(Error):
|
|
|
|
class ChannelError(Error):
|
|
|
|
"""Raised when a channel dies or has been closed."""
|
|
|
|
"""Raised when a channel dies or has been closed."""
|
|
|
@ -87,9 +93,15 @@ class Dead(object):
|
|
|
|
def __eq__(self, other):
|
|
|
|
def __eq__(self, other):
|
|
|
|
return type(other) is Dead
|
|
|
|
return type(other) is Dead
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __reduce__(self):
|
|
|
|
|
|
|
|
return (_unpickle_dead, ())
|
|
|
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
def __repr__(self):
|
|
|
|
return '<Dead>'
|
|
|
|
return '<Dead>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _unpickle_dead():
|
|
|
|
|
|
|
|
return _DEAD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#: Sentinel value used to represent :py:class:`Channel` disconnection.
|
|
|
|
#: Sentinel value used to represent :py:class:`Channel` disconnection.
|
|
|
|
_DEAD = Dead()
|
|
|
|
_DEAD = Dead()
|
|
|
|