如何在SmartGWT RPCManager中拦截错误处理

如何在SmartGWT RPCManager中拦截错误处理,gwt,smartgwt,Gwt,Smartgwt,我正在将SmartGWT与RestDataSource一起使用。每当我失去互联网连接时,我都会看到一个SC.warn窗口,其中包含: Server returned TRANSPORT_ERROR with no error message 我尝试截获此消息以创建更友好的消息,方法是为RPCManager添加回调处理程序,如下所示: RPCManager.setHandleTransportErrorCallback(new HandleTransportErrorCallback() {

我正在将SmartGWT与RestDataSource一起使用。每当我失去互联网连接时,我都会看到一个SC.warn窗口,其中包含:

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直接连接到服务器

如何截获此错误消息

谢谢

试试吧