I'm used to check if the user try to store a valid data with cathcing the ConsratinViolationException
, like that:
try {
//persisitng to a db
}
catch (ConstraintViolationException e){
//Print message
}
I'm using PostgreSQL
and now I'm under the isssue that the persisitng can violate more than one different constarints. How can I distiguish in the catch clause what exactly constraint has been violated?
I need to do that, because the message the programm will print depending on that.