There are two options for error-toss:
1) "Old-style" (==current approach ;)) where no error handler is
registered for a given method
2) A method can always be an error handler for itself:
@expose(...)
def foo(self, errors=None, bar=""):
...
foo = error_handler(foo)(foo)
There are two caveats (both trivial to fix) with 2) in my current
implementations. As can be seen above one cannot use decorator syntax
for a recursive error handler definition. I propose changing
error_handler to allow calls without arguments to handle this case.
And second, ff an exception is raised inside the method which handles
it's own errors, a nasty "infinite" loop can ensue. Some stack prodding
should do the trick here.
Cheers,
Simon
Kevin Dangoor wrote:
What I'm not certain about with that path (and I do need to get back
to those couple of tickets about better error handling) is that you
can't easily toss validation errors back to the method that originally
displayed the form. I'll take another look at those tickets sometime
soon, though, and decide which (if any) solution makes it in 0.9. If
nothing jumps out at me, I may defer this until sometime between 0.9
and 1.0.
Kevin