[Zope] Re: Exceptions and Python Scripts
Chris Withers
chrisw@nipltd.com
Wed, 21 Feb 2001 15:10:26 +0000
Evan Simpson wrote:
>
> Is there any specific exception that you are interested in catching, but
> can't?
Exceptions.Exception was the example I mentioned...
> try:
> # whatever
> except:
> # Handle Exception
>
> ...will work without needing Exception itself.
Okay, the real problem is twofold:
1. Zope is littered with string exceptions
2. Catching exceptions that you didn't mean to is a Real Bad Thing (tm)
Put these two together and and you need to use sys.exc_info() to analyse the
type and value to decide whether you should re-raise it or not.
Of course, you're not allowed to import anything from sys in Python Scripts so
you're left with no options.
Any ideas?
cheers,
Chris