Hey everyone,

I am trying to determine the location where an exception is caught in
the client side of a bit of code.

With a little testing I have found that throwing an exception in a RPC
call will be caught by the onFailure clause of that specific call,
however, since I would like to use the exceptions higher up, it feels
like they should be caught by the try-catch-block around the actual
invocation.

The example code below should clarify what I mean. The remote method
test will simply throw an Exception when called.

...

// Setup
ExTestServiceAsync serviceProxy = (ExTestServiceAsync) GWT.create
(ExTestService.class);
((ServiceDefTarget)serviceProxy).setServiceEntryPoint
(GWT.getModuleBaseURL() + "ExTestService");
AsyncCallback<String> callback = new AsyncCallback<String>() {
        public void onFailure (Throwable caught) {

                GWT.log("RPC error", caught); // <-- This is what is triggered 
and
what shows in the GWT log window.

        }
        public void onSuccess (String result) {
                GWT.log("RPC Succes: ", null);
        }
};

...

// Make the call
try {
        serviceProxy.test(true, callback);
} catch (Exception e) {

        GWT.log("Exception while attempting RPC.", null); <-- This is where I
would like the exception to be caught.

}

...

As you can see, the exception that is thrown is caught in the wrong
place IMHO. It feels like the onFailure should only fire when the RPC
mechanism has a problem (something that GWT should generate) and an
exception that is thrown by programmer code should be handled in the
catch block of the actual call.

I understand that this will most likely yield tons of problems with
the whole asynchronous thing (in fact I am sure one excludes the
other), but the actual call still needs to have a try-catch-block
which seems never to be called.

Am I making a fundamental flaw in my logic or is this an unresolved
issue?

Patrick
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to