Source for file ErrorController.php

Documentation is available at ErrorController.php

  1. <?php
  2. /**
  3.  * @ignore
  4.  */
  5. class ErrorController extends Zend_Controller_Action
  6. {
  7.  
  8.     public function errorAction()
  9.     {
  10.         $errors $this->_getParam('error_handler');
  11.         
  12.         if (!$errors{
  13.             $this->view->message 'You have reached the error page';
  14.             return;
  15.         }
  16.         
  17.         switch ($errors->type{
  18.             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
  19.             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
  20.             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
  21.         
  22.                 // 404 error -- controller or action not found
  23.                 $this->getResponse()->setHttpResponseCode(404);
  24.                 $this->view->message 'Page not found';
  25.                 break;
  26.             default:
  27.                 // application error
  28.                 $this->getResponse()->setHttpResponseCode(500);
  29.                 $this->view->message 'Application error';
  30.                 break;
  31.         }
  32.         
  33.         // Log exception, if logger available
  34.         if ($log $this->getLog()) {
  35.             $log->crit($this->view->message$errors->exception);
  36.         }
  37.         
  38.         // conditionally display exceptions
  39.         if ($this->getInvokeArg('displayExceptions'== true{
  40.             $this->view->exception $errors->exception;
  41.         }
  42.         
  43.         $this->view->request   $errors->request;
  44.     }
  45.  
  46.     public function getLog()
  47.     {
  48.         $bootstrap $this->getInvokeArg('bootstrap');
  49.         if (!$bootstrap->hasResource('Log')) {
  50.             return false;
  51.         }
  52.         $log $bootstrap->getResource('Log');
  53.         return $log;
  54.     }
  55.  
  56.  
  57. }

Documentation generated on Wed, 15 Jun 2011 15:58:39 +0300 by phpDocumentor 1.4.1