The exceptions wouldn't be generated by a missing method. They are
often generated by contacting other web-services or working with other
applications running on the server (ie image generator) or my cache-
engine. They are generally handled by exception handling in the
Action. I was just looking for a backstop that can provide some
universal handling for exceptions that aren't caught. This would be
useful in the example I gave.

Thanks for the link. I'll look into doing this the PHP 4/Cake way: the
ErrorHandler class. But, does anybody have a good solution using
Exceptions and try/catch?

Thanks.

On Mar 24, 2:46 am, John Andersen <j.andersen...@gmail.com> wrote:
> 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 <joshs.silver...@gmail.com> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com 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.

Reply via email to