|
Hi all,
I'm looking for a way to return a generic error every time something goes wrong with a REST request. So for example, I would like to return a simple, XML response like: <error> There was a problem processing your request. </error> Anytime something goes wrong when something is accessed via REST (e.g. the template is in the View/$ControllerName/xml folder) but NOT when the page is accessed normally (the template is in the View/ $ControllerName/ folder). Is there way way to do this in Cake? Or perhaps a smarter way to achieve similar functionality? Thanks, -Will -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
On Jan/02, Will wrote: > Hi all, > > I'm looking for a way to return a generic error every time something > goes wrong with a REST request. So for example, I would like to > return a simple, XML response like: > > <error> > There was a problem processing your request. > </error> > > Anytime something goes wrong when something is accessed via REST (e.g. > the template is in the View/$ControllerName/xml folder) but NOT when > the page is accessed normally (the template is in the View/ > $ControllerName/ folder). Is there way way to do this in Cake? Or > perhaps a smarter way to achieve similar functionality? What about install a custom exception handler which outputs your formatted message on screen? This ways you will be able to handle both core and custom exceptions so that they are rendered as you whish. Regards, Matteo > > Thanks, > > -Will > > -- > Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php > -- http://www.matteolandi.net -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
|
The Custom Exception Handler should also send out correct headers.
:-) On 03.01.2012 10:06, Matteo Landi wrote: > > On Jan/02, Will wrote: >> Hi all, >> >> I'm looking for a way to return a generic error every time something >> goes wrong with a REST request. So for example, I would like to >> return a simple, XML response like: >> >> <error> >> There was a problem processing your request. >> </error> >> >> Anytime something goes wrong when something is accessed via REST (e.g. >> the template is in the View/$ControllerName/xml folder) but NOT when >> the page is accessed normally (the template is in the View/ >> $ControllerName/ folder). Is there way way to do this in Cake? Or >> perhaps a smarter way to achieve similar functionality? > What about install a custom exception handler which outputs your formatted > message on screen? This ways you will be able to handle both core and custom > exceptions so that they are rendered as you whish. > > > Regards, > Matteo > >> Thanks, >> >> -Will >> >> -- >> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org >> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. >> >> >> To unsubscribe from this group, send email to >> [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php >> -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cake-php |
| Powered by Nabble | Edit this page |
