Zend_Controller
[ class tree: Zend_Controller ] [ index: Zend_Controller ] [ all elements ]

Source for file ErrorController.php

Documentation is available at ErrorController.php

  1. <?php
  2. /**
  3.  * MediaSearch
  4.  *
  5.  * LICENSE
  6.  *
  7.  * "THE BEER-WARE LICENSE" (Revision 42):
  8.  * "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
  9.  * As long as you retain this notice you can do whatever you want with
  10.  * this stuff. If we meet some day, and you think this stuff is worth it,
  11.  * you can buy me a beer in return.
  12.  *
  13.  * $Author$
  14.  * $Revision$
  15.  *
  16.  * @category    MediaSearch
  17.  * @package     Zend_Controller
  18.  * @copyright   Copyright (c) 2009 Sven Strittmatter
  19.  */
  20.  
  21. /**
  22.  * Default error controller.
  23.  *
  24.  * @see Zend_Controller_Action
  25.  *
  26.  * @category   MediaSearch
  27.  * @package    Zend_Controller
  28.  * @copyright  Copyright (c) 2009 Sven Strittmatter
  29.  */
  30. class ErrorController extends Zend_Controller_Action {
  31.     /**
  32.      * Default error action.
  33.      *
  34.      * @access public
  35.      */
  36.     public function errorAction({
  37.         $errors $this->_getParam('error_handler');
  38.  
  39.         switch ($errors->type{
  40.             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
  41.             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
  42.  
  43.                 // 404 error -- controller or action not found
  44.                 $this->getResponse()->setHttpResponseCode(404);
  45.                 $this->view->message 'Page not found';
  46.                 break;
  47.             default:
  48.                 // application error
  49.                 $this->getResponse()->setHttpResponseCode(500);
  50.                 $this->view->message 'Application error';
  51.                 break;
  52.         }
  53.  
  54.         $this->view->exception $errors->exception;
  55.         $this->view->request   $errors->request;
  56.         $this->view->env   APPLICATION_ENV;
  57.     }
  58. }

Documentation generated on Mon, 17 Aug 2009 14:52:21 +0200 by phpDocumentor 1.4.2