dieselpoint / norm

Access a database in one line of code.
Other
205 stars 36 forks source link

Unable to handle DB exceptions #45

Closed harishyadav-t closed 5 years ago

harishyadav-t commented 5 years ago

There is only one DbException for generic db exceptions.But what if I want to write custom messages for particular SQLIntegrityConstraintViolationException exception because DbExcpetion is generic.

How to know whether it's SQLIntegrityConstraintViolationException or some other dbconnection exceptions or some other.

Please help me....

ccleve commented 5 years ago

Trap the DbException and examine exception.getCause(). That will give you the underlying exception.