PDA

View Full Version : Raising Errors



jpcook01
2 Jul 2012, 12:48 AM
Hi

I have been looking at the Error handling support in ext-js which looks great and I have something working quite nicely. In my Store I have the following proxy



proxy: {
type: 'ajax',
url: 'proxy/get/json/sitemap/list',
listeners: {
exception: function(proxy, response, options) {
if(response.status == 403) {
Ext.Error.raise({
msg: 'You do not have permission to use this application',
option: options,
'error code': 403
});
}
}
}
},


Then in my app.js I have:


launch: function() {

Ext.Error.handle = function(err) {
Ext.Msg.alert('Error', 'You have not have permission to use this application');
},


It is working ok but I still see the errors logged to the console in something like firebug. I wondered if there was a way to switch this off. I have looked at the

Ext.Error.ignore (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.Error-static-property-ignore) = true;

But it doesn't seem to do anything?

Thanks
Jon

scottmartin
2 Jul 2012, 1:14 PM
This is for Ext errors, and not native JS errors. Most browsers have an option to disable JS errors.
You can use:


function noError(){return true;}
window.onerror = noError;


Scott.