public function actionDelete($id)
{
if(Yii::app()->request->isPostRequest)
{
// we only allow deletion via POST request
try
{
$this->loadModel($id)->delete();
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
if(!isset($_GET['ajax']))
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
}
catch (Exception $e)
{
throw new CTestException('User in use, Delete Refrences.');
//Yii::app ()->user->setFlash ( 'error', "User in use, Delete Refrences." );
}
}
else
{
throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
}
}
I want to catch the inner exception and show an alert. its setflash is not working plus if i'm throwing a custom exception it's alerting the stack of error 500 as well, the exception which im trying to handl.