Reputation: 573
I execute my async function and before the result I reload the browser I get error - OnFailure(Throwable) is executed. Status error code is 0.
This problem is on FireFox and Chrome.
Could you tell me what this status code means.
do(new AsyncCallback<Boolean>() {
@Override
public void onSuccess(Boolean result) {}
@Override
public void onFailure(Throwable throw) {
do_sth();
}
});
Boolean do() { while(true); }
That also return status error 0
Upvotes: 0
Views: 170
Reputation: 46219
You could always define your onFailure()
like this (adapted from the GWT API) to be able to handle different kinds of failure nicely:
public void onFailure(Throwable caught) {
try {
throw caught;
} catch (IncompatibleRemoteServiceException e) {
// this client is not compatible with the server; cleanup and refresh the
// browser
} catch (InvocationException e) {
// the call didn't complete cleanly
} catch (YourOwnException e) {
// take appropriate action
} catch (Throwable e) {
// last resort -- a very unexpected exception
}
}
Upvotes: 0
Reputation: 64541
The 0
status code here means the request has been aborted (it could also denote a network error, or the request timed out).
See http://www.w3.org/TR/XMLHttpRequest/#the-status-attribute and http://www.w3.org/TR/XMLHttpRequest/#error-flag
Upvotes: 1