try catch

Good afternoon

I have





public function actionDelete($id)

	{

		try{	

			if(Yii::app()->request->isPostRequest)

			{

				// we only allow deletion via POST request

				$this->loadModel($id)->delete();


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

				if(!isset($_GET['ajax'])){

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

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

				}else{

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

				}

			}

			else{

				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:

http://www.yiiframework.com/wiki/21/