I am developing a REST API using the latest CakePHP. I was under the impression (from a presentation I watched on YouTube from CakeFest 2010) that I could throw an error and have it return the error as JSON to the client by adding a json direction below /app/View/Errors and adding the appropriate error file (i.e. error400.ctp) in that directory. The API itself is working (i.e. if I call /tenants/30.json it returns the tenant with id 30 as json). However, when I throw a NotFoundException it is outputting the HTML template under /app/View/Errors/error400.ctp instead of the json template under /app/View/Errors/json/error400.ctp.
What do I have to do to get it to output the json template?
-- What do I have to do to get it to output the json template?
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment