From 4473008d65d5aa36141a6668101397b59a844c7a Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 22 Jan 2014 14:57:54 +0100 Subject: [PATCH] Show error message and stack trace on exceptions refs #5507 --- application/controllers/ErrorController.php | 13 +++++-------- application/views/scripts/error/error.phtml | 17 ++++++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index ddca3bb18..b49248d16 100755 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -42,26 +42,23 @@ class ErrorController extends ActionController */ public function errorAction() { - $errors = $this->_getParam('error_handler'); - switch ($errors->type) { + $error = $this->_getParam('error_handler'); + switch ($error->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: - // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); $this->view->message = 'Page not found'; break; default: - // application error $this->getResponse()->setHttpResponseCode(500); - $this->view->message = 'Application error'; + $this->view->message = $error->exception->getMessage(); break; } - // conditionally display exceptions if ($this->getInvokeArg('displayExceptions') == true) { - $this->view->exception = $errors->exception; + $this->view->stackTrace = $error->exception->getTraceAsString(); } - $this->view->request = $errors->request; + $this->view->request = $error->request; } } // @codingStandardsIgnoreEnd diff --git a/application/views/scripts/error/error.phtml b/application/views/scripts/error/error.phtml index c51ab59da..5421df980 100755 --- a/application/views/scripts/error/error.phtml +++ b/application/views/scripts/error/error.phtml @@ -1,9 +1,12 @@ tabs->render($this); ?> - -
-

An error occurred

- - messageBox)) : ?> - messageBox->render() ?> - +
+

+
+ +
+
+ +messageBox)) : ?> + messageBox->render(); ?> +