Environment
- GWT 2.5 using RequestFactory
- EclipseLink 2.4.1
- PostgreSQL 9.1
Problem
To give context to the part of RequestFactory I'm looking at, I've inserted the structure of the snippet below:
requestContext.persist().fire(new Receiver<ObjectProxy>(){
@Override
public void onSuccess(ObjectProxy response){
//Run code here...
}
@Override
public void onFailure(ServerFailure error){
//See the description below for what needs to be done here.
}
In the onFailure() function, I'd like to have different responses to the errors that may be thrown by Postgresql such as a violation of the uniqueness constraint when a user tries to insert a new barcode or new id number that has already been taken (the user must be able to choose the id).
This does not just have to be in the onFailure() function - I am looking for some place in the framework to do this handling.
Questions
- How do you identify and respond to different error types thrown by the database or server in GWT RequestFactory?