CErrorHandler 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:
  • development views, named as exception.php;
  • production views, named as error<StatusCode>.php;
where <StatusCode> stands for the HTTP error code (e.g. error500.php). Localized views are named similarly but located under a subdirectory whose name is the language code (e.g. zh_cn/error500.php). Development views are displayed when the application is in debug mode (i.e. YII_DEBUG is defined as true). Detailed error information with source code are displayed in these views. Production views are meant to be shown to end-users and are used when the application is in production mode. 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:
  1. themes/ThemeName/views/system: when a theme is active.
  2. protected/views/system
  3. framework/views
If the view is not found in a directory, it will be looked for in the next directory. 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 {@link CApplication::getErrorHandler()}.


Displaying 1-6 of 6 results.
maxSourceLines25Maximum number of source code lines to be displayed. Defaults to 25.integer
maxTraceSourceLines10Maximum number of trace source code lines to be displayed. Defaults to 10. @since 1.1.6integer
adminInfo'the webmaster'The application administrator information (could be a name or email link). It is displayed in error pages to end users. Defaults to 'the webmaster'.string
discardOutputtrueWhether to discard any existing page output before error display. Defaults to true.boolean
errorAction'site/error'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.string
behaviorsarray()The behaviors that should be attached to this component. The behaviors will be attached to the component when {@link init} is called. Please refer to {@link CModel::behaviors} on how to specify the value of this property.array