I am working with CakePHP 2.0 and want to handle ForbiddenException. I followed the example described in the CakePHP Cookbook.
My exception is now caught in an AppExceptionHandler, but I don't know how to get from here. I want to display the corresponding view, but $this not available. Does anyone have a starting point for me?
Edit:
My code is still identical to the cookbook example:
In the application /Config/core.php
Configure::write('Exception.handler', 'AppExceptionHandler::handle');
In the application /Config/bootstrap.php
App::uses('AppExceptionHandler', 'Lib');
In the application /Lib/AppExecptionHandler.php
class AppExceptionHandler { public static function handle($error) { if($error instanceOf ForbiddenException ){ echo 'Oh noes! ' . $error->getMessage();
Regards, Bart
source share