Skip to content
Snippets Groups Projects
Commit 53fa3a8b authored by xamgore's avatar xamgore
Browse files

Controller catches exceptions at before() & after() methods

parent 655b9109
No related merge requests found
......@@ -65,9 +65,6 @@ abstract class Kohana_Controller {
*/
public function execute()
{
// Execute the "before action" method
$this->before();
// Determine the action to use
$action = 'action_'.$this->request->action();
......@@ -80,17 +77,20 @@ abstract class Kohana_Controller {
)->request($this->request);
}
// Execute the action itself
try {
// Execute the "before action" method
$this->before();
// Execute the action itself
$this->{$action}();
// Execute the "after action" method
$this->after();
} catch (LogicException $e) {
throw HTTP_Exception::factory(404, $e->getMessage())
->request($this->request);
}
// Execute the "after action" method
$this->after();
// Return the response
return $this->response;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment