try catch

Good afternoon

I have

public function actionDelete($id)





				// we only allow deletion via POST request


				// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser


					Yii::app()->user->setFlash("success","Máquina Eliminada Correctamente.");

					$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));


					Yii::app()->user->setFlash("error","La Máquina no puede ser Eliminada.");




				throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');


		}catch(CDbException $e){

			Yii::app()->user->setFlash("error","La Máquina no puede ser Eliminada ya que se encuentra asociada a un arriendo.");



I have this code to capture the error 500.

the error disappears, but does not display the message of the sentence - try catch - to remove a machine.

help me!!!!

You need to render a (partial) view, if you want to see the messages: