团队成员将此项目纳入我们的项目
$(function() {
$("body").bind("ajaxError", function(event, XMLHttpRequest, ajaxOptions, thrownError){
alert(thrownError);
});
}
但是我想压制我的一个错误(因为它会是噪音并且不需要验证)
function blah() {
...
errFunc = function(event, xhr, opts, errThrown) {
//what could I do here?
//event.stopImmediatePropagation()?
}
$.ajax({
url : '/unimportant_background_refresh',
type : 'GET',
data : { },
dataType : 'json',
success : updateBackgroundStuff,
error : errFunc, // Suppresses error message.
});
}
我该如何阻止所有错误发生?我可以在错误函数中执行某些操作,例如 { event.StopPropogation(); }
或者我必须找出一些机制,让捕获所有选择性地忽略了吗?