gae gwt rpc error 0
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?
精彩评论