setting up good error handling structure.
This commit is contained in:
parent
f796b576e3
commit
b3bd8a0755
7 changed files with 57 additions and 26 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
Reference in a new issue