* CErrorHandler handles uncaught PHP errors and exceptions.
* ErrorHandler handles uncaught PHP errors and exceptions.
*
* It displays these errors using appropriate views based on the
* nature of the error and the mode the application runs at.
* It also chooses the most preferred language for displaying the error.
*
* CErrorHandler uses two sets of views:
* ErrorHandler uses two sets of views:
* <ul>
* <li>development views, named as <code>exception.php</code>;
* <li>production views, named as <code>error<StatusCode>.php</code>;
...
...
@@ -33,7 +32,7 @@ Yii::import('CHtml',true);
* For security reasons, they only display the error message without any
* sensitive information.
*
* CErrorHandler looks for the view templates from the following locations in order:
* ErrorHandler looks for the view templates from the following locations in order:
* <ol>
* <li><code>themes/ThemeName/views/system</code>: when a theme is active.</li>
* <li><code>protected/views/system</code></li>
...
...
@@ -44,70 +43,151 @@ Yii::import('CHtml',true);
* The property {@link maxSourceLines} can be changed to specify the number
* of source code lines to be displayed in development views.
*
* CErrorHandler is a core application component that can be accessed via
* ErrorHandler is a core application component that can be accessed via
* {@link CApplication::getErrorHandler()}.
*
* @property array $error The error details. Null if there is no error.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package system.base
* @since 1.0
* @since 2.0
*/
classCErrorHandlerextendsCApplicationComponent
classErrorHandlerextendsApplicationComponent
{
/**
* @var integer maximum number of source code lines to be displayed. Defaults to 25.
*/
public$maxSourceLines=25;
public$maxSourceLines=25;
/**
* @var integer maximum number of trace source code lines to be displayed. Defaults to 10.
* @since 1.1.6
*/
public$maxTraceSourceLines=10;
/**
* @var string the application administrator information (could be a name or email link). It is displayed in error pages to end users. Defaults to 'the webmaster'.
*/
public$adminInfo='the webmaster';
public$adminInfo='the webmaster';
/**
* @var boolean whether to discard any existing page output before error display. Defaults to true.
*/
public$discardOutput=true;
public$discardExistingOutput=true;
/**
* @var string the route (eg 'site/error') to the controller action that will be used to display external errors.
* Inside the action, it can retrieve the error information by Yii::app()->errorHandler->error.
* This property defaults to null, meaning CErrorHandler will handle the error display.
* This property defaults to null, meaning ErrorHandler will handle the error display.