But, how do I throw different type of exceptions? I need to show different messages for different type of exceptions.
I have tried throwing different exceptions with different messages as:
throw new StatusCodeException(1, "Error adding values");
But when onFailure method is invoked, it receives Throwable object with description "There was some error on invoking service" (can't remember the exact description as I'm not in front of the program now).
Is there any way to differentiate the errors at the client side?
That's because you did not specify these exceptions in the methods signature of the GWT service class. You can search for "gwt handling exceptions" in a search engine.
Yep, just define your custom exception (it should extend IsSerializable class) and in the signature of the method in your service you have to declare that exception can be thrown.
In the "onFailure" method you simply compare like: