function errorAction() { $error = $this->_getParam('error_handler'); $detailedErrorMessage = RM_Log::createErrorMessage($error->exception); $config = Zend_Registry::get('config'); RM_Log::toLog($detailedErrorMessage, RM_Log::ERR); if ((int) $config->get('errors')->get('debug') == 1) { $errorMessage = $detailedErrorMessage; ob_end_clean(); header('RMError: 1'); echo nl2br($errorMessage); die; } switch ($error->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found'); //TODO: add language constants, but better is to add a 404 page template $content = "Requested page not found."; break; default: $this->getResponse()->setHeader('RMError', '1'); //TODO: add language constants, but better is to add a 404 page template $content = "Sorry, there was a server error. Please contact to site administrator."; break; } $this->getResponse()->clearBody(); $this->view->content = $content; }
function errorAction() { $error = $this->_getParam('error_handler'); $detailedErrorMessage = RM_Log::createErrorMessage($error->exception); $config = Zend_Registry::get('config'); $logResult = RM_Log::toLog($detailedErrorMessage, RM_Log::ERR); if ((int) $config->get('errors')->get('debug') == 1) { $errorMessage = nl2br($detailedErrorMessage); } else { //TODO: add language constants. $errorMessage = "There was internal server error."; if ($logResult == false) { $errorMessage .= " Please make file system_log.txt writable to log error messages."; } else { $errorMessage .= " All information is in system_log.txt file."; } } ob_end_clean(); header('RMError: 1'); echo $errorMessage; die; }