On Aug 26, 12:51 am, Paul Robinson <
ukcue...@gmail.com> wrote:
> 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?
No, and in fact, if I declare them explicitly, then GWT throws them as-
is, rather than wrapping them in InvocationException.
> 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.
That's what I'm afraid of. It looks like GWT will only allow declared
exceptions, and not subclasses. I don't want to extend Exception,
because it means the Java compiler will force me to handle the
exception explicitly:
try {
service.remoteMethodThatThrowsException( ... , new
AsyncCallback<Void>() {
@Override
public void onFailure( Throwable caught ) { ... }
@Override
public void onSuccess( Void result ) {...}
} );
} catch (Exception e) {}
That sort of defeats the purpose for handling the exception in the
onFailure() method to begin with.