Hello, I am build a REST API using CakePHP 2.0.5 and I have a question about custom ExceptionHandlers.
I want to render exceptions differently depending on the content negotiation from the REST call. The only way I can figure out how to do this right now is by checking the CakeRequest object inside of a Controller method, however I don't know how to access this object from within a custom ExceptionHandler. For example: http://my.restapi.com/posts/41.json throws a NotFoundException() AppExceptionHandler code: class AppExceptionHandler { public static function handleException($error) { $response_type; // Extract this from CakeRequest switch ($response_type) { case 'json': AppExceptionHandler::renderJson($error); break; case 'xml': AppExceptionHandler::renderXml($error); break; case 'html': default: AppExceptionHandler::renderHtml($error); break; } } } Could someone help me out here? Is this possible on 2.0.5? -- 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
