PDA

View Full Version : json store exception



Dmoney
13 Jul 2010, 7:54 AM
I'm trying to check a php session when I load a store. if the session has expired I want to return a failed message. I'm trying to use an exception listener to do this.

if the session has expired my response looks like this :

{"resultText":"Session Expired"}

and my exception listener looks like this :


exception: function(proxy, type, action, options, res, arg) {

Ext.Msg.show({
title: 'REMOTE EXCEPTION',
msg: res.resultText,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});

myGrid.store.removeAll();
}},


the message box appears but there is no message res.resultText is blank. anyone know what I'm doing wrong.

Elijah
13 Jul 2010, 8:07 AM
If you are able to return a response, then it is NOT an exception.
Yours response is a success and you will need to check the value of the response if == to Session Expired
and handle accordingly

Dmoney
13 Jul 2010, 8:19 AM
it's the exception listener thats firing though. the load listener only fires if I return records even a response like this :

{"totalRecords":null,"totalCount":0,"vendorDatabase":null}

is registering as an exception.

Elijah
13 Jul 2010, 8:28 AM
try 1 using FireFug console.info('res: ' + res) to see what you have
also
msg: Ext.decode(res.responseText)