/ Published in: PHP
URL: http://forum.kohanaframework.org/comments.php?DiscussionID=5016&page=1#Item_0
Expand |
Embed | Plain Text
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)); } }
Comments
Subscribe to comments
You need to login to post a comment.

Otra versión del mismo concepto: http://github.com/vimofthevine/kyletreubig.com/blob/master/application/bootstrap.php
Habría que detectar si el error es producto de una url incorrecta (tendríamos que lanzar un error 404 Not Found) o si es un error interno de la aplicación (cualquier otro error que no sea el 404), por lo que tendríamos que arrojar un error 503. http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=40132