Project

General

Profile

1 11 aaronmk
# Exception handling
2
3
def add_msg(ex, msg): ex.args = (str(ex).rstrip()+'\n'+msg,)
4 13 aaronmk
5
class ExceptionWithCause(Exception):
6
    def __init__(self, msg, cause=None):
7
        Exception.__init__(self, msg)
8
        if cause != None: add_msg(self, 'cause: '+str(cause))