Handlling GWT呼叫失败
问题描述:
你好,我在GWT有一段代码,我的一位高级同事写了这段代码。Handlling GWT呼叫失败
public void onFailure(Throwable caught) {
if (caught instanceof RuntimeException) {
if (caught instanceof StatusCodeException
&& caught.getMessage().contains(
"<title>Error 500 unAuthorized</title>")) {
MessageBox
.alert("Session has been expired. Press Ok to redirect to Login page.");
History.newItem(HistoryToken.INDEX_PAGE.toString());
} else {
MessageBox
.alert("An exception has occured.Press Ok to continue.");
}
} else if (caught instanceof InvocationException) {
MessageBox
.alert("Sorry... Some error occured while reaching to server.");
}
}
什么是执行else if (caught instanceof InvocationException) {
块时呼叫服务器失败的可能性有多大?
我认为else if (caught instanceof InvocationException)
在任何情况下都不会被执行。 有何建议?
感谢您的回复。这家伙离开了这家公司。 – 2011-03-16 11:30:48