Thursday, August 25, 2011

Inherited exceptions in GWT-RPC

My understanding is that in GWT-RPC, if a service throws an exception
declared in the signature, then GWT will report that exception back to
the client as-is. If it's any other exception that's thrown, then GWT
wraps it in an InvocationException.

I have a hierarchy of exceptions that could get thrown in my
application. For example:

class AException extends RuntimeException {}
class BException extends AException {}
class CException extends AException {}

If I declare AException in the client, and throw it in the server,
then the onFailure() method gets called with AException as expected.
However, if I declare AException in the client, but throw either of
the two child classes in the server, GWT wraps it in an
InvocationException.

What is the best way to intercept ALL the child exceptions? The only
thing I can see so far is declaring each possible child exception in
the service signature, but that seems very brittle to me.

Thanks,
Ryan

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment