Revision 2144
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/exc.py | ||
---|---|---|
43 | 43 |
def e_ct_exit_status(e_ct): return min(e_ct, 255) |
44 | 44 |
|
45 | 45 |
class ExceptionWithCause(Exception): |
46 |
def __init__(self, msg, cause=None): |
|
46 |
def __init__(self, msg, cause=None, cause_newline=False):
|
|
47 | 47 |
add_traceback(self) |
48 |
if cause != None: msg += ': '+str_(cause) |
|
48 |
if cause != None: |
|
49 |
if cause_newline: msg += '\ncause' |
|
50 |
msg += ': '+str_(cause) |
|
49 | 51 |
Exception.__init__(self, msg) |
50 | 52 |
|
51 | 53 |
def str_(e): |
Also available in: Unified diff
exc.py: ExceptionWithCause: Added cause_newline option to put the cause on its own line instead of on the message line