blanket except clause -- best practice?
John J. Lee
jjl at pobox.com
Tue Oct 28 20:14:33 EST 2003
More information about the Python-list mailing list
Tue Oct 28 20:14:33 EST 2003
- Previous message (by thread): blanket except clause -- best practice?
- Next message (by thread): PEP 289: Generator Expressions (ACCEPTED)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
George Young <gry at ll.mit.edu> writes: > [python 2.3.2, SuSE Linux 8.2, x86] [...] > try: > stuff > except _pg.error, msg: > raise DatabaseError, "error '%s' in '%s'" % ( msg, sql ) > except: > raise OperationalError, "internal error in '%s'" % sql > > > This accomplishes passing useful info, namely "sql", on with > the exception. Unfortunately it *loses* info in that upstream > has no way to know *which* exception triggered this or what args > it might have been given. I'm trying to think of a clean way > to improve this. I could do: Just have an attribute of OperationalError that holds the exception caught by the except: John
- Previous message (by thread): blanket except clause -- best practice?
- Next message (by thread): PEP 289: Generator Expressions (ACCEPTED)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list