开发者

How to intercept Error handling in SmartGWT RPCManager

I'm using SmartGWT with RestDataSource. Whenever I lose internet connection, I get an SC.warn window with:

Server returned TRANSPORT_ERROR with no error message

I have tried to intercept this message to create a more friendly message, by adding a Callback handler for RPCManager like so:

RPCManager.setHandleTransportErrorCallback(new HandleTransportError开发者_如何学运维Callback() {

    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.");

        }
    });

However, the Error messages print, and my warn message shows, but so does the system warn message above!

Keep in mind that I'm using a RestDataSource and not directly connecting to server with RPCManager.

How can I intercept this error message?

Thanks


Try instead RPCManager.setHandleErrorCallback(..).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜