Hi all.

It would be nice if I could catch CapabilityDisabledException on the client
in the RPC calls onFailure callback methods but it appears it isn't
possible; seems like the exception can only be declared in server code so I
came up with another solution and would like your feedback.

I am thinking about defining a custom exception derived from Throwable and,
sharing it between the client and server. I'd catch
CapabilityDisabledException in my RPC methods and in response I would throw
my custom throwable exception back to the client. In my client's RPC
onFailure callback methods I would catch my custom exception in the
following manner:

                   @Override
                    public void onFailure(Throwable caught) {
                        try{
                            throw caught;
                        }catch (MyCapabilityDisabledException e) {  *<<===
catch it here**
*                             // direct the user to a view which explains
that the db is not available and to try again later
                        }
                        }catch(IncompatibleRemoteServiceException e){
                        }catch (InvocationException e){
                        }catch (Throwable e) {
                            Window.alert("Severe error!");
                        }
                    }

What do you think, do you like the solution or do you have a better one that
you have implemented and successfully tested and used?

Thanks in advance for your feedback.

-- 
*Jeff Schwartz*

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