Hi,
I have a question about the proper use of error handling code with
RequestBuilder. I can't figure out what's gonna happen, when something
goes wrong, and the proper way to handle such situations.
I've already searched this group's archives and googled it a bit but
couldn't find anything relevant (or even remotely associated). The
documentation (javadoc) is not clarifying enough (IMHO).
Some (pretty much standard) example code:
// Create new request builder
RequestBuilder builder = new RequestBuilder
(RequestBuilder.POST, configuration.LOGIN_URL());
// set other headers, params, etc.
// Send the request
try {
request = builder.sendRequest(data, new RequestCallback()
{
public void onError(Request request, Throwable exception)
{
// Handle errors: dispatch a message on the event bus to show an
error message
}
public void onResponseReceived(Request request, Response
response) {
// Parse response according to HTTP status code...
});
} catch (RequestTimeoutException e) {
// Do we have to handle the error again? Or just ignore it
since we handled it in onError?
} catch (RequestException e) {
// Ditto...
}
The question is ... if, for example, a RequestTimeoutException happens
what's the sequence of things?
Case 1:
onError() gets called AND then a RequestTimeoutException is thrown and
handled by the external try / catch block?
Case 2:
Only the exception is being thrown without calling onError() method of
the callback class?
Case 3:
The onError() method is called and no exception is being thrown?
Or which case happens depends on external factors (browser, OS, other
things)?
We tried to delve in the code and figure out what's going on but
couldn't really wrap our heads around it. A clarification from the
Google guys who know the code well enough would be awesome!
Thanks in advance for any responses,
-fotos
PS. GWT is great ... but you already know that. :)
www.rento.gr
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.