On 2/7/06, Simon Belak <[EMAIL PROTECTED]> wrote:
>
> Kevin Dangoor wrote:
> > As you can see from the above history, I've tended to treat validation
> > errors and exceptions differently. They seem like different beasts to
> > me. Validation errors occur through normal program operation, because
> > users don't always enter what you'd expect. Exceptions represent an
> > honest-to-goodness problem with the system.
> >
> > Unless there are realistic use cases where people expect exceptions to
> > be raised with the same sort of frequency as validation errors, I'd
> > like to make sure that we handle validation errors as the primary case
> > and then exception catching as something that can be done via
> > error_handler(). Does that make sense?
>
> I for one prefer a more generalised approach, unifying anything causing
> ruptures in control-flow to be handled the same. I have already proposed
> to Jeff to make Identity raise a "normal" exception and move the
> (redirection) logic to an error handler but haven't heard from him yet.
> In my mind, ideally any and all (authentication, input, model, ...
> -related) error handling would be separated from actual [controller]
> functionality. This has undoubtedly affected my implementation of error
> handling, in retrospective I should have taken a more natural POV. I
> would like this to be nicely integrated into the whole control-flow but
> I certainly do not want to introduce something a majority of
> users/developers will find cumbersome or not intuitive.

The generalized error_hander mechanism is fine and flexible on the
whole. But, I'd still contend that validation errors are of a
different breed than actual programming exceptions and deserve mildly
special treatment as a result.

I'd only support moving identity's redirect logic to an error handler
if you didn't have to explicitly put references to it all over the
place. (@identity.require is nice and easy, and the control flow for
the identity piece does not involve the controller, so it's still
clean...)

> Since I am writing a wish list, I might as well mention this. I do not
> like redirects. It would feel much more natural to just simply call a
> method. If this method happens to be exposed, the URL should be
> rewritten behind the scenes.

What do you mean by "the URL should be rewritten behind the scenes"?
There are actually certain advantages to doing a real browser redirect
(users don't keep posting the same form over and over again, for
example).

Kevin

Reply via email to