As far as I remember, you don't need to do try catch, just compare the
current action against the actions defined in the controller. For
example you can do the following (quick and dirty solution) in the
AppController beforeFilter method:
[code]
if (!in_array($this->params['action'], get_class_methods($this))) {
do your error processing
}
[/code]
or even better, you can try to make your own cakeError processing.
See:
http://book.cakephp.org/view/154/Error-Handling
Enjoy,
John
On Mar 24, 6:43 am, Josh <[email protected]> wrote:
> Hello
>
> I would like to somehow apply a try catch statement to all Actions as
> a backstop for any uncaught exceptions.
>
> I think this would be particularly helpful for Ajax Actions, because
> the catch statement could send back a default 4xx status code.
> Prototype's onFailure() function could then do the client-side error
> handling.
>
> How can I do this without wrapping the Action call with a try/catch in
> the cake dispatcher ($controller->dispatchMethod($params['action'],
> $params['pass']);)
>
> Does anybody have a suggestion or another workable strategy for
> gaining this functionality?
>
> Josh
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
To unsubscribe from this group, send email to
cake-php+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.