[Zope-dev] urgent: string exceptions

Chris McDonough chrism@zope.com
11 Apr 2003 09:07:07 -0400


You can catch most string exceptions.  "Bad Request" cannot be caught
because (afaik) the string isn't interned because it has a space in it.

As a workaround, I'd use except: then do

try:
   something
except:
   e = sys.exc_info()
   if e[0] == 'Bad Request':
      do something
   raise

On Fri, 2003-04-11 at 05:57, Lennart Regebro wrote:
> Christian Theune wrote:
> > a) Remove "Bad Request" beeing a String exception and make it a class
> > exception
> 
> Yup. Don't use String Exceptions. One reason is that you can't catch 
> them. :)
> 
> 
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )