/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
try { // Attempt to execute the response $request->execute(); } catch (Exception $e) { if ( ! IN_PRODUCTION) { // Just re-throw the exception throw $e; } try { // Log the error Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e)); // Create a 404 response $request->status = 404; $request->response = View::factory('template') ->set('title', '404') ->set('content', View::factory('errors/404')); } catch (Exception $e) { echo "Something terrible happened. We will look into it!"; Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e)); } }
URL: http://forum.kohanaframework.org/comments.php?DiscussionID=5016&page=1#Item_0