Hello. I'm thinking of writing something like this:
<?php
try {
$stmt = Yii::app()->db->getPdoInstance()->prepare($sql);
// Do something.
catch(PDOException $e) {
throw new CException($e->getMessage());
}
My questions are:
-
Is this the correct way to throw a Yii CException?
-
Do I need the try-catch block at all? Or will Yii automatically catch a PDOException and complain?
Thanks.