PDA

View Full Version : How to catch JsonReader Exception



Schottkey
19 Jul 2011, 1:23 AM
Could someone tell me how I can catch the following exception?

Uncaught Ext.data.JsonReader.getResponseData: Unable to parse JSON returned by Server.

It appears not to be caught when I attach a listener to 'exception' or 'loadexception' on my Ext.data.Store object, my Ext.data.Proxy object or my Ext.data.Reader object.

Any help would be very much appreciated!

art.dev.ext
19 Jul 2011, 1:32 AM
Override Ext.data.JsonReader.getResponseData function
or do a
try {
} catch(e){
}
around the call to store.load()

Schottkey
19 Jul 2011, 2:18 AM
Brilliant. You have completely fixed my problem, Thank you.

In the end I overrode the method so I could keep with an asynchronous load, but now it works perfectly!

art.home.ext
16 Aug 2011, 12:31 PM
You are welcome.

I think no exception should be thrown since it hangs code execution.

An implementation like in Java world would have been more flexible...Maybe in another life...