Revision 2756
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/exc.py | ||
---|---|---|
46 | 46 |
class ExceptionWithCause(Exception): |
47 | 47 |
def __init__(self, msg, cause=None, cause_newline=False): |
48 | 48 |
add_traceback(self) |
49 |
|
|
49 | 50 |
if cause != None: |
50 | 51 |
if cause_newline: msg += '\ncause' |
51 | 52 |
msg += ': '+str_(cause) |
53 |
|
|
52 | 54 |
Exception.__init__(self, msg) |
55 |
|
|
56 |
self.cause = cause |
|
53 | 57 |
|
54 | 58 |
def str_(e, first_line_only=False): |
55 | 59 |
if isinstance(e, SyntaxError): |
Also available in: Unified diff
exc.py: ExceptionWithCause: Store the cause in an instance variable for later use