Package grassyknoll :: Package concurrent :: Module errors
[hide private]

Source Code for Module grassyknoll.concurrent.errors

 1  """errors for the concurrent package""" 
 2   
 3  import traceback 
 4   
 5  __all__=['ConcurrentError', 'TimeoutError', 'SendError', 'ReceiveError', 'BoxFullError', 
 6           'BoxClosedError', 'BoxEmptyError', 'CrashError'] 
 7   
8 -class ConcurrentError(StandardError):
9 """base class for errors in this package""" 10 pass
11
12 -class TimeoutError(ConcurrentError):
13 """error for general timeouts""" 14 pass
15
16 -class SendError(ConcurrentError):
17 """error raised when sending fails""" 18 pass
19
20 -class ReceiveError(ConcurrentError):
21 """error raised when receive fails""" 22 pass
23
24 -class BoxFullError(SendError):
25 """error raised when a mailbox is full""" 26 pass
27
28 -class BoxClosedError(SendError):
29 """error raised when a mailbox is closed"""
30
31 -class BoxEmptyError(ReceiveError):
32 """error raised when a mailbox is empty""" 33 pass
34 35 # XXX this is basically identical to Fault
36 -class CrashError(ConcurrentError):
37 """error raised when a message recipient chokes 38 39 @ivar type: the type of the exception 40 @type type: type 41 42 @ivar value: the exception instance 43 @type value: instance 44 45 @ivar traceback: a stringified traceback that produced the exception. May 46 be None 47 @type traceback: traceback 48 """ 49 __slots__=['type', 'value', 'traceback'] 50
51 - def __init__(self, etype, value, tb):
52 self.type=etype 53 self.value=value 54 self.traceback="".join(traceback.format_exception(etype, value, tb)) 55 ## Exception constructors are totally braindamaged, just do something. 56 ## see http://docs.python.org/lib/module-exceptions.html 57 Exception.__init__(self, etype, value, self.traceback)
58