Archived
1
0
Fork 0

setting up good error handling structure.

This commit is contained in:
H Hautakoski 2010-08-28 17:04:06 +02:00
parent f796b576e3
commit b3bd8a0755
7 changed files with 57 additions and 26 deletions

View file

@ -4,11 +4,31 @@ class ErrorController extends Zend_Controller_Action
{
public function errorAction()
{
$this->view->args = $this->_request->getParams();
$error = $this->_getParam('error_handler');
$this->view->error = $this->_request->getParam('error_handler');
// display debug information if we are in a developer environment.
if (ini_get('display_errors')) {
$this->_helper->layout->setLayout('clean');
$this->view->error = $error;
$this->render('debug');
return;
}
switch($error->type) {
// 404 - Page not found
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION :
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER :
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE :
$this->_forward('page-not-found');
break;
// 500 - Application error
default :
$this->getResponse()->setHttpResponseCode(500);
}
}
public function pageNotFoundAction()
{
$this->getResponse()->setHttpResponseCode(404);
}
}