Unhandled Exception, Prior To Controller Creation

I am having a problem where an exception message is not being handled by the site/error handler. The call stack (see attached) doesn’t involve any controller, and it is just displaying two lines of HTML, as shown in the attached image.

The site error handler works fine for other errors. I’ve tried creating a system folder in protected/views, but the exception.php there is not being invoked. I even tried modifying the Yii exception.php file temporarily, but that change did not appear in the output.

So my questions are: (1) how can I shunt this error to my regular error handling page? and (2) where and why is it dumping just these two lines of HTML (since the Yii error handling pages are full pages of HTML)?

Any assistance would be appreciated!



It depends on the debug mode.

If you disable debug (comment the line

defined('YII_DEBUG') or define('YII_DEBUG',true);

in index.php,

your db-error will be rendered into the site/error handler, otherwise it will be rendered like your second screenshot with the trace message.