Customize Error Message Display For Cdbexecption

Hi Folks,

I am trying to change the display for CDExecption and all before Entry Application Entry point.

Let me explain to you what i have done so far. I have provided an interface to set a application configuration variables like Database Connection Details,And predefined params and e.t.c

But i would like to handle all the error message with a customize display.Basically what i am looking for to handle a CDBExecption error of dtabase connection. If there is a false or blank entry for database details. :)

I don’t want to show the Error message Simply.Just want to customize it.i am trying to change it by creating a view file under protected/views/system/ but it is not working.

Also i have tried to change this display with defining errorHandling component in main.php file But still its not done for me.

So,any suggestion,help would be appreciated.

Looking forward to hear from you.

Thanks and Regards,

Dear Jeyanth

I have no idea how you are implementing this scheme.

Kindly check whether the following is useful to your scenario.


{      //collect $db,$name AND $password from user.


	Yii::app()->db->setActive(false);//Inactivate any existing active database connection.



		'connectionString' => 'mysql:host=localhost;dbname='.$db,

		'username' =>$name,

		'password' =>$password,



	Yii::app()->db->setActive(true);//Activate new one.


catch(CDbException $e)

{       //If there are errors,Without throwing errors we are redirecting to our custom error view.




//If there are no errors, we can redirect to some other place.




Thanks for your reply.But Yii set component will work inside the controller. But as i have already mentioned in my post that i have to do this task before the yii Entry point.So that dynamically i can overwrite settings in main.php file.:)

Anyways i am almost done with my solution for it.:)

Thanks and Regards,

Dear Friend

We can attach the above code in a behavior method and we can rise it onBeginRequest event of main application.

Anyway I am glad that you have found a solution.