2011-06-29 47 views
3

我正在使用SmartGWT和RestDataSource。每當我失去互聯網連接,獲得帶有SC.warn窗口:如何攔截SmartGWT RPCManager中的錯誤處理

Server returned TRANSPORT_ERROR with no error message 

我試圖攔截此消息創造一個更友善的信息,通過添加一個回調處理RPCManager像這樣:

RPCManager.setHandleTransportErrorCallback(new HandleTransportErrorCallback() { 

    public void handleTransportError(int transactionNum, int status, 
     int httpResponseCode, String httpResponseText) { 

     System.err.println("Transaction number: "+transactionNum); 
     System.err.println("Status: "+status); 
     System.err.println("Response code: "+httpResponseCode); 
     System.err.println("Response text:"+httpResponseText); 

     SC.warn("You have no internet connection."); 

     } 
    }); 

但是,錯誤消息打印,我的警告消息顯示,但上面的系統警告消息也是如此!

請記住,我正在使用RestDataSource,而不是直接使用RPCManager連接到服務器。

我該如何攔截此錯誤消息?

感謝

回答