[Zope-CMF] Re: [dev] some questions regarding Exceptions
Yuppie
schubbe at web.de
Thu Sep 18 06:56:05 EDT 2003
Hi!
Dieter Maurer wrote:
> Yuppie wrote at 2003-9-16 12:59 +0200:
> > ...
> > After rereading the python docs, I think the root exception has to be
> >
> > class CMFError(Exception):
> >
> > Thats the easy part.
>
> I do not think, it should derive from "Exception" but from
> "StandardError".
>
> There are exceptions that are not errors, e.g. ConflictError.
> It should be easy to catch just errors with "except StandardError"
> and let non-error exceptions through.
Look at POSException.py:
class POSError(StandardError): ...
class TransactionError(POSError): ...
class ConflictError(TransactionError): ...
ConflictError is derived from StandardError! "except StandardError"
isn't saver than a bare except.
> This is widely not adhered, too, but we may start with it.
Are you sure thats the Right Way?
<http://www.python.org/doc/current/tut/node10.html#SECTION0010500000000000000000>
shows an example with
class Error(Exception): ...
<http://www.python.org/doc/current/lib/module-exceptions.html> says:
StandardError:=The base class for all built-in exceptions except
StopIteration and SystemExit.
Cheers,
Yuppie
More information about the Zope-CMF
mailing list