Configure::read('App.encoding'))); try { $controller = new TestAppsErrorController($request, $response); $controller->layout = 'banana'; } catch (Exception $e) { $controller = new Controller($request, $response); $controller->viewPath = 'Errors'; } return $controller; } }