PDA

View Full Version : Wrap error to be caught by an Exception handler



johija
29 Jul 2013, 12:34 PM
Consider this scenario in a Model class: Can we route an error to the store's proxy exception listeners.

try {
// Error
} catch (err) {
// Can we throw an Exception from here to be caught by the Store's Exception listeners?
}

slemmon
2 Aug 2013, 12:53 PM
You should be able to fire an exception event against the store's proxy.
Normally the listener will be passed three args which you may have to mock up if you want the listener to have them from a manually fired exception event.



var proxy = store.getProxy();
proxy.fireEvent('exception', proxy);


http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.proxy.Ajax-method-fireEvent