[Zope-dev] urgent: string exceptions

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


That'd be fine, but it would require a code audit.  And third party
products might fail.

On Fri, 2003-04-11 at 09:14, Christian Theune wrote:
> Sorry for split-post.
> 
> OTOH as the string can't be caught anyway, and it is defined as a module
> variable, we could simply drop the space, hmm?
> 
> Cheers,
> Christian
> 
> Am Fre, 2003-04-11 um 15.07 schrieb Chris McDonough:
> > 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 )
> -- 
> Christian Theune, gocept gmbh & co. kg
> http://www.gocept.com - ct@gocept.com
> fon: 03496 3099112 fax: 03496 3099118 mobile: 0179 7808366
>