catching all exceptions
Steve Purcell
stephen_purcell at yahoo.com
Thu Feb 8 10:24:36 EST 2001
Arne wrote:
>
> with this I think I can catch all predefined exception classes, because
> Exceptions is the base class for all other exceptions, but I realy want
> to know which derived exception class was raised (and also the
> stack-trace).
>
> Is there (simple) way to do that in python (1.5.2)?
Yes.
try:
something
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
# Then write to database.
-Steve
--
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Available for consulting and training.
"Even snakes are afraid of snakes." -- Steven Wright
More information about the Python-list
mailing list