[Zope3-dev] Please, no bare 'except:' clauses!
Steve Alexander
steve@cat-box.net
Mon, 11 Nov 2002 13:26:37 +0000
> try:
>
> except DatabaseError: # All ZODB/transactional errors (conflicts,
> etc)
>
> except ZopeError: # All Zope framework exceptions
>
> except AppError: # All application defined exceptions
>
> except Exception: # All Python exceptions
>
> Probably the only one that would not subclass Exception would be
> DatabaseError,
Are you sure that's right?
In Zope 3, we seem to have
Exception <- StandardError <- TransactionError <- ConflictError
> so saying except Exception: would actually be useful
> since it would trap all errors that were exceptions and no others,
> and modules would not need to be dependant on the ZODB directly just
> to handle exceptions properly.
--
Steve Alexander