PDA

View Full Version : Exceptionlistener store



kortovos
21 Dec 2010, 1:09 AM
My app communicates with a webservice through several stores and readers. But every so often, the webservice is offline or something is wrong with the returned data. Is there a way to put a exception listener on a store or proxy, which will catch any error (and unmask the page so that the user can still continue working with the app)?

Any help would be appreciated.

chris-mac
16 Jan 2011, 7:32 AM
Hi,

Did you maybe manage to attach exception listener to the store proxy?

I am trying with the following code:


var myStore = new Ext.data.Store({
model: 'MyModel',
proxy: {
type: 'ajax',
url: '/my-url',
reader: {
type: 'json',
root: 'my_root'
},
listeners: {
exception: function(){
console.log('store exception');
}
}
}
});


but for some reason it doesn't work. Any help/suggestions very much appreciated.

kortovos
16 Jan 2011, 11:32 PM
I tried that also, but it only fires the exception when it the doesn't get an answer within time. If it gets an non-xml (I use xml instead of json) response, it gives an error (which isn't caught by the exceptionlistener). When it gives an xml response, which doesn't match the model, it gives an error (which also isn't caught by the exceptionlistener).