Project

General

Profile

1
# Exception handling
2

    
3
def add_msg(ex, msg): ex.args = (str(ex).rstrip()+'\n'+msg,)
4

    
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))
(3-3/11)