Catch Cdbexceptions And Display Pretty Page

Hi everyone.

I would like to catch CDbExceptions, much like catching CHttpExceptions, to display a nice page with the information that I want, while logging the error to DB if possible.

I know that if it set YII_DEBUG to false I can get the error without the trace, which is fine, except that it is presented in a plain HTML file with no styles or anything and I can’t seem to do that.

The main intention is to display a nice page when the DB is down entirely, with the style of the website with appropriate text.

Is there a way to do this?