[Solved]How to prevent exceptionHandler produce stack when throw CHttpException in ajax call

Prior to Yii 1.1.8 when throw CHttpException in ajax call, the response text only produce the message that the user set. But in version 1.1.8, it also produce

<h1>CHttpException</h1>

message

and the function call stacks

(I believe this is Enh #2556)

How to revert it back to only make it only produce error message without any header or any stack? Because I write code that receive message from the exception message to display to the user. The error header and stack make it become unfriendly toward user.

You can simply implement an action error, and display the error in a totally customized view.

But by using action error, does it throw error/exception so can be catch by ajax on error?

I believe my problem has some similarity with the issue 2628. Guest need to wait until 1.1.9 release to fix this problem.

Meanwhile, for temporary fix I use the version 1.1.7 of the CErrorHandler (I copy it and put into my components and named it as HErrorHandler)

and in the config I set it into:


'errorHandler' => array(

	'class'=>'application.components.base.HErrorHandler',

	'errorAction' => 'site/error',

),