问题描述:在网上查找了多种资料,也试了很多方法,在dwr包中的engine.js进行修改
解决方案:过滤 failed to read input,改为
dwr.engine.defaultErrorHandler = function(message, ex) {
dwr.engine._debug("Error: " + ex.name + ", " + ex.message, true);
if (message == null || message == "") alert("A server error has occured.");
// Ignore NS_ERROR_NOT_AVAILABLE if Mozilla is being narky
else if (message.indexOf("0x80040111") != -1) dwr.engine._debug(message);
else if (message.indexOf("Failed to read input") == -1) alert(message);
};
或修改成
dwr.engine.defaultErrorHandler = function(message, ex) {
dwr.engine._debug("Error: " + ex.name + ", " + ex.message, true);
if (message == null || message == "") alert("A server error has occured.");
// Ignore NS_ERROR_NOT_AVAILABLE if Mozilla is being narky
else if (message.indexOf("0x80040111") != -1) dwr.engine._debug(message);
else alert(message);
};
都没有反应,也许我的程序还没有运行到这里来。
在自己的项目中修改common.jsp,对下面这一段代码进行修改。
DWREngine.setErrorHandler(function(e){
Ext.MessageBox.show({
title: 'Error:',
msg:e.toString(),
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
});
修改后的结果为
DWREngine.setErrorHandler(function(e){
if(e.toString()=="Failed to read input"){
return Ext.topShow.msg("Friendly tips:","Server busy!");
}
Ext.MessageBox.show({
title: 'Error:',
msg:e.toString(),
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
});
解决方案:过滤 failed to read input,改为
dwr.engine.defaultErrorHandler = function(message, ex) {
dwr.engine._debug("Error: " + ex.name + ", " + ex.message, true);
if (message == null || message == "") alert("A server error has occured.");
// Ignore NS_ERROR_NOT_AVAILABLE if Mozilla is being narky
else if (message.indexOf("0x80040111") != -1) dwr.engine._debug(message);
else if (message.indexOf("Failed to read input") == -1) alert(message);
};
或修改成
dwr.engine.defaultErrorHandler = function(message, ex) {
dwr.engine._debug("Error: " + ex.name + ", " + ex.message, true);
if (message == null || message == "") alert("A server error has occured.");
// Ignore NS_ERROR_NOT_AVAILABLE if Mozilla is being narky
else if (message.indexOf("0x80040111") != -1) dwr.engine._debug(message);
else alert(message);
};
都没有反应,也许我的程序还没有运行到这里来。
在自己的项目中修改common.jsp,对下面这一段代码进行修改。
DWREngine.setErrorHandler(function(e){
Ext.MessageBox.show({
title: 'Error:',
msg:e.toString(),
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
});
修改后的结果为
DWREngine.setErrorHandler(function(e){
if(e.toString()=="Failed to read input"){
return Ext.topShow.msg("Friendly tips:","Server busy!");
}
Ext.MessageBox.show({
title: 'Error:',
msg:e.toString(),
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
});