Skip to content
Permalink
Browse files

Dispatch afterDispatch event when exception is thrown

  • Loading branch information...
biesbjerg committed Jul 13, 2016
1 parent 7763e5d commit bddff7d2b0c57d756b1ec1eadb3e7da7c8236622
Showing with 16 additions and 2 deletions.
  1. +16 −2 lib/Cake/Error/ExceptionRenderer.php
@@ -20,9 +20,12 @@
*/
App::uses('Sanitize', 'Utility');
App::uses('Dispatcher', 'Routing');
App::uses('Router', 'Routing');
App::uses('CakeResponse', 'Network');
App::uses('Controller', 'Controller');
App::uses('CakeRequest', 'Network');
App::uses('CakeResponse', 'Network');
App::uses('CakeEvent', 'Event');
/**
* Exception Renderer.
@@ -287,7 +290,7 @@ public function pdoError(PDOException $error) {
protected function _outputMessage($template) {
try {
$this->controller->render($template);
$this->controller->afterFilter();
$this->_shutdown();
$this->controller->response->send();
} catch (MissingViewException $e) {
$attributes = $e->getAttributes();
@@ -327,4 +330,15 @@ protected function _outputMessageSafe($template) {
$this->controller->response->send();
}
protected function _shutdown() {
$this->controller->afterFilter();
$Dispatcher = new Dispatcher();
$afterDispatchEvent = new CakeEvent('Dispatcher.afterDispatch', $Dispatcher, array(
'request' => $this->controller->request,
'response' => $this->controller->response
));
$Dispatcher->getEventManager()->dispatch($afterDispatchEvent);
}
}

0 comments on commit bddff7d

Please sign in to comment.
You can’t perform that action at this time.