1 : <?php
2 :
3 : class ErrorController extends Zend_Controller_Action
4 0 : {
5 :
6 : public function errorAction()
7 : {
8 0 : $errors = $this->_getParam('error_handler');
9 :
10 0 : switch ($errors->type) {
11 0 : case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
12 0 : case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
13 0 : case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
14 :
15 :
16 0 : $this->getResponse()->setHttpResponseCode(404);
17 0 : $this->view->message = 'Page not found';
18 0 : break;
19 0 : default:
20 :
21 0 : $this->getResponse()->setHttpResponseCode(500);
22 0 : $this->view->message = 'Application error';
23 0 : break;
24 0 : }
25 :
26 :
27 0 : if ($log = $this->getLog()) {
28 0 : $log->crit($this->view->message, $errors->exception);
29 0 : }
30 :
31 :
32 0 : if ($this->getInvokeArg('displayExceptions') == true) {
33 0 : $this->view->exception = $errors->exception;
34 0 : }
35 :
36 0 : $this->view->request = $errors->request;
37 0 : }
38 :
39 : public function getLog()
40 : {
41 0 : $bootstrap = $this->getInvokeArg('bootstrap');
42 0 : if (!$bootstrap->hasPluginResource('Log')) {
43 0 : return false;
44 : }
45 0 : $log = $bootstrap->getResource('Log');
46 0 : return $log;
47 : }
48 :
49 :
50 : }
51 :
|