When a called the persist() method from server, a exception is throwed after a validation in uniques of a email.
The problem is that onSuccess method from client is called, instead of onFailure. Here is the code.
RequestContext req = driver.flush();
if (req.isChanged() && !driver.hasErrors()) {
saveButton.setEnabled(false);
req.fire(new Receiver<Void>() {
@Override
public void onSuccess(Void response) {
//anything
}
@Override
public void onFailure(ServerFailure error) {
//anything
}
});
}
public User persist() throws GenericException{ // extends from Exception
//query in database
throw new GenericException("Email must be unique");
//save case is correct
}
Any help?