DEV Community

Discussion on: Ignoring Exceptions in Java

Collapse
 
florianschaetz profile image
(((Florian Schätz)))

Especially for database exceptions, I suggest also having a look at Spring's version: It uses explicit converters to convert the SQLExceptions into a hierarchy of RuntimeExceptions, where the root is DataAccessException. This allows for completely optional and much more meaningfull exception handling (for example, an opertions that threw a TransientDataAcessException can simply be re-tried, while one that threw a NonTransientDataAccessException like BadSqlGrammarException would not get better by re-trying).