Reputation: 49
I am new to Yii framework, in this i am working on small project but it throwing error pages if any errors appearing from database..
Please help me how to stop these error pages and to display some customized error page
I have been struggling to get this for some time, so any help would be greatly appreciated!!
Upvotes: 3
Views: 5382
Reputation: 1695
To customize error page modify the view: /protected/views/site/error
- "site" is your default controller.
You can change it via /protected/config/main.php
:
'errorHandler'=>array(
'errorAction'=>'myController/error',
),
And in your controller you have the action:
public function actionError()
{
if($error=Yii::app()->errorHandler->error)
{
if(Yii::app()->request->isAjaxRequest) {
echo $error['message'];
}
else
$this->render('error', $error);
}
}
So you can do whatever you want.
Upvotes: 6
Reputation: 1115
try to comment the line in index.php
defined('YII_DEBUG') or define('YII_DEBUG',true);
Upvotes: 6