Displaying Cdbexception In Custom View

Hi,

I need/want to have any CDbException rendered in a custom view, which I decide what to print and what not. For some reason, CDbException is being thrown ("CDbConnection failed to open the DB connection.") yet I cannot overwrite the display of it, no matter what I tried.

Is there a way to customize this view?

Thanks!

What have you tried already?

I override the default error handling action as in the tutorial: http://www.yiiframework.com/doc/guide/1.1/en/topics.error.

I read it, of course, but I didn’t see a way there to override DB connection errors reports in CDbException. I did see there how to override/customize misc CHttpExceptions an in general handle errors but not what I’m looking for.

Have I missed it?

In my error handling action I would analyze the exception available in Yii::app()->errorHandler->error.

Check the exception class if it’s a CDbException and then extract the specific exception code.

Every database has its own codes. I did used that trick to detect unique constraint violation exceptions.