Exceptions

destr0 joel*nospam*list at litriusgroup.com
Thu May 30 02:29:02 EDT 2002


Hello all,

I'm having trouble with exceptions.  I'm writing a program where I want to
catch an exception and extra data and use that data to send an email.

def func1():
    raise queryError, "There was an Error"
#first of all.. .am I giving the exception name properly?

try:
    func1()
except:
    #I'm having trouble putting together a statement here to     #grab the
extra data I sent to use for something else.

do I use:
except queryError, data:
    print data

When I do this I get mixed results.. sometimes it seems to throw an extra
name exception for queryError.  Also.. I don't like this.. because I'd like
to be able to catch all exceptions and latch on to their data, instead of
explicitly writing a catch statement for each exception I might have .





More information about the Python-list mailing list