senthil,
When you declare your method signatures in the your synchronous interface, you need to specify that it throws SerializableException:
public interface PartService extends RemoteService {
public CategoryTO[] getCategories(String type) throws SerializableException
}
Then, in your implementation class, just rethrow the exception:
public class PartServiceImpl extends RemoteServiceServlet implements PartService {
public CategoryTO[] getCategories(String type) throws SerializableException {
// code, code, code
try {
// more code
} catch (Throwable caught) {
throw new SerializableException(caught.getMessage());
}
}
}
Now, you can catch them in your onFailure method of your AsyncCallback handler:
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
One thing to keep in mind is that you do not put a throws signature in your Async interface, so it would look like this for this example:
public interface PartServiceAsync {
public void getCategories(String type, AsyncCallback callback);
}
HTH,
Chad