[Zope-dev] ConflictError shouldn't subclass Exception

Patrick Gerken do3ccqrv at googlemail.com
Fri Nov 25 14:25:24 EST 2005


2005/11/24, Chris Withers <chris at simplistix.co.uk>:
 > Interestingly, you can raise things that don't subclass Exception in
> python. This was discussed before, and I firmly agree with, that zodb
> conflicts should _not_ sublcass exception. That way, there's less chance
> of them being caught by inexperienced programmers putting in try: except
> Exception: 's.
>
> How would we go about making this change?

class my_own_exception:
  pass

try:
  raise my_own_exception()
except:
  print "Doesn't help against inexperienced programmers. sadly"

You can even raise a string, which is accidently done in zope2 and
where my with provided solution and unit test is pending.
It is better to beat people using except: without good reasons.

Patrick


More information about the Zope-Dev mailing list