Difference between #1 and #2 of
Display a nice exception message on ajax requests

Revision #2 has been created by Maurizio Domba Cerin on Aug 29, 2011, 10:44:41 AM with the memo:

example in new line
« previous (#1)


Title unchanged

Display a nice exception message on ajax requests

Category unchanged


Yii version unchanged

Tags unchanged

error, exception

Content changed



in Yii versions previous to 1.1.9 exceptions was handled differently during ajax request and displayed by [CApplication::displayException()](http://www.yiiframework.com/doc/api/1.1/CApplication#displayException-detail "displayException()"). This way the exception message displayed on ajax requests could not be customized.
The message for the CGridView delete request with YII_DEBUG set to true looked like
![old exception message on ajax request](http://i1107.photobucket.com/albums/h397/mdomba/yiierror-old.jpg "old exception message on ajax request")

In Yii version 1.1.9 the check for ajax request has been removed so now the exception message is handled by [CErrorHandler::errorAction](http://www.yiiframework.com/doc/api/1.1/CErrorHandler#errorAction-detail "errorAction") even during ajax requests.

This way the message can be customized for ajax requests.
12 0
Viewed: 41 030 times
Version: 1.1
Category: Tips
Last updated by: Maurizio Domba Cerin
Created on: Aug 29, 2011
Last updated: 6 years ago
Update Article


View all history