troll February 2016

ErrorHandling in Yii

I have developed a web application using Yii, but I can't rich error handling solution.

This is my code

config/main.php

'components'=>array(
   'errorHandler'=>array(
        // use 'site/error' action to display errors
        'errorAction'=>'site/error',
    ),
),

SiteController

public function actionError()
{

    if($error=Yii::app()->errorHandler->error)
    {
        if(Yii::app()->request->isAjaxRequest)
        {
            echo $error['message'];

        }
        else
            $this->render('error', array('error'=>$error));
    }
}

Then not work

Showing

Showing

How can I reach this solution?

Answers


troll February 2016

This problem solved Itself.

How to solved this problem

Add error function on the inside accessRules function

And comment config/main.php

/* array(
    'class'=>'CWebLogRoute',
    'enabled'=>defined('YII_DEBUG'),
  ), */

That's it

Hope help anyone

Post Status

Asked in February 2016
Viewed 2,580 times
Voted 4
Answered 1 times

Search




Leave an answer