Thursday, September 16, 2010

Re: Unchecked exceptions from server to client

Hi again,

I did more "research" about our way of handling exceptions.
Most of our service methods doesnt have any throws declarations but
all of them have validation, which is throwing runtime exception (here
we are sending field names with errors).

"Bad" service:
public interface ExceptionModuleService extends RemoteService {
void validate();

void getObject();
}

In this case, code from my previous code wont work. GWT will throw
SerializationException, since it cant serialize GwtClientException,
which would be thrown in both methods.
BUT in this case:
public interface ExceptionModuleService extends RemoteService {
void validate();

void getObject() throws RuntimeException; // or our
GwtClientException
}
Problem is gone... Every method from service can throw our
RuntimeExceptions.

Is it feature or a bug?

Example code: http://san0.org/gwt/gwt-ex.zip

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