[Zope-CMF] Re: [dev] Exceptions: small proposal
Dieter Maurer
dieter at handshake.de
Tue Sep 23 13:43:12 EDT 2003
Yuppie wrote at 2003-9-23 08:38 +0200:
> ...
> My motivation for these changes was to make it easier to catch
> Exceptions in skin Scripts. At least we would need to make Unauthorized
> accessible TTW.
>
> Right now there exists no save catch all Exception. Skin Scripts often
> do high level end user error handling. It's not the perfect solution,
> but I think subclassing from CMFError provides a quite save catch all
> for that kind of errors.
But wrapping would only help when it were complete.
"Unauthorized", e.g., may be raised by Zope's security code outside
the reach of CMF.
In my view, it would then be better to ensure that Zope uses
a uniform "Unauthorized" exception which can be caught rather
than wrapping some "Unauthorized" exceptions into a CMFUnauthorzied.
By the way, DCWorkflow should not raise an "Unauthorized" when
a guard expression fails or the transition is not valid in
the current state.
In order that an exception is meaningful, there must be a clear
understanding how to react on the error.
"Unauthorized", e.g., should only be raised when there is
at least a chance to perform the action as a different user.
An unavailable transition from a state or a failing "guard_expr"
does (usually) not fall into this category.
> But if people don't want this, I can live without. Maybe just end user
> focused raise statements should use wrapped standard errors.
That's a very good idea!
Dieter
More information about the Zope-CMF
mailing list