Revision 1610
Added by Aaron Marcuse-Kubitza over 12 years ago
exc.py | ||
---|---|---|
44 | 44 |
|
45 | 45 |
class ExceptionWithCause(Exception): |
46 | 46 |
def __init__(self, msg, cause=None): |
47 |
add_traceback(self) |
|
48 |
if cause != None: msg += ': '+str_(cause) |
|
47 | 49 |
Exception.__init__(self, msg) |
48 |
add_traceback(self) |
|
49 |
if cause != None: add_msg(self, 'cause: '+str_(cause)) |
|
50 | 50 |
|
51 | 51 |
def str_(e): return ''.join(traceback.format_exception_only(type(e), e)) |
52 | 52 |
|
Also available in: Unified diff
exc.py: ExceptionWithCause: Prepend msg to cause's msg separated by ': ' instead of '\ncause: '