开发者

gae gwt rpc error 0

开发者 https://www.devze.com 2023-02-24 01:08 出处:网络
sometimes when i call an rpc to my app on Google App Engine, an error is thrown. Normally i would just put the error code out with an Window.Alert(), and then go and read the logs and solve the proble

sometimes when i call an rpc to my app on Google App Engine, an error is thrown. Normally i would just put the error code out with an Window.Alert(), and then go and read the logs and solve the problem..

This time however the error code is simply "0" and nothing is put in the log-files. The code looks like this:

myService.doStuff(new AsyncCallback<Boolean>() 
        {
            @Override
            public void onSuccess(Boolean result) 
            {
                if(result)
                    Window.alert("yay");
                else
                    Window.alert("nay");
            }

            @Override
            public void onFailure(Throwable caught) 
            {   
                Window.alert(caught.getMessage());
            }
        });

Most of the times, i get a yay/nay depending on success, however some rare times i just get a "0".. What is this? :s

T开发者_如何学Gohe server side code can be anything really, getting/storing in datastore, checking if a user is signed in etc. This happens randomly on most of my RPC-calls.


The caught object is probably an instance of StatusCodeException. The 0 status code is seen when the underlying XHR isn't transmitted by the browser, although the triggers for this case are somewhat browser-dependent. For example, the 0 status code is seen when attempting to make an XHR for a file:// URL (although that's probably not what's going on in this case).

Since you describe the problem as occurring randomly, my guess is that there's something in the browser's environment that's affecting XHRs. Does this occur on just a single browser, or all browsers installed on your machine? Does this happen across multiple machines?

0

精彩评论

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