In my main config file I have:
'components'=>array(
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
In my sitecontroller is
public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if ( CDbException == $error->type) {
$this->redirect(array("site/error")); }
else if(Yii::app()->request->isAjaxRequest) {
echo $error['message']; }
else
$this->render('error', $error);
}
}
And I have a view in the ..views\site\error.php
How can I have the error displayed in a view rather than the CDbException being written straight to the browser?

Help











