Hi Koen,
I think multiple Views are the way to go here. Your NotFoundErrorView
could then forward to the 404 action, for example, so you don't have
too much duplicate code. If your 404 action is empty, i.e. just a
view (which it should be), then you could also return array
(AgaviConfig::get('actions.404_module'), AgaviConfig::get('actions.
404_action')) from the action to make agavi use that view instead of
one related to the action itself. You can talk to the validation
manager (available from the container) inside handleError() to find
out which validator failed, and then return the appropriate view name.
Hope that helps,
David
Am 27.06.2007 um 12:18 schrieb Van Daele, Koen:
> Hi all,
>
> I'm trying to decide how to go about handling crud errors. From the
> IRC
> logs I've gathered that the best approach would be to have:
> - An InputView
> - An ErrorView that uses the InputTemplate
> - A SuccessView that redirects to
>
> The problem I'm having is that there are different types of errors.
> E.g
> take a simple Book.Edit action. The first possible error is a user
> trying to edit a book that doesn't exist (should return a 404 or a
> 'sorry, this book doesn't exist' page. The second type of error is a
> user entering incorrect data (a validation error) that show the input
> template again. A third possible error might be that there's a
> concurreny issue (should e.g. tell the user to re-edit the record or
> should ask them if they're sure they want to overwrite user z's edit).
>
> Do you use different Error views (eg. InputErrorView,
> NotFoundErrorView,
> ConcurrencyErrorView)? Or do you set an attribute in the action and
> then
> let the error view decide what to do? Are there other options?
>
> Greetings,
> Koen
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users