You shouldn't need to do anything. It should work as you thought. That is, you 
can throw any subclass of the declared exception(s).

Is there something about BException and CException that stops them from being 
gwt-serializable?

Alternatively, maybe it's because AException extends RuntimeException, and is 
therefore not a checked exception. It could be that, being an unchecked 
exception, GWT silently drops it (or rather, its subclasses) from the list of 
exceptions to expect.

Try "AException extends Exception" instead.

HTH
Paul

On 25/08/11 21:09, Ryan wrote:
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 [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