The table below lists SQL state codes and exceptions that map to them. Every driver exception class extends some rdbc exception type. You can extract information specific to PostgreSQL from the driver-specific exceptions.

SQL state
(X means any digit)
Driver exception type rdbc exception type
42501 PgUnauthorizedException UnauthorizedException
57014 PgTimeoutException TimeoutException
28XXX PgAuthFailureException AuthFailureException
42XXX PgInvalidQueryException InvalidQueryException
23XXX PgConstraintViolationException ConstraintViolationException
any other PgUncategorizedStatusDataException UncategorizedRdbcException

The driver also defines a number of exceptions that don't map to any SQL state codes. For complete list see the scaladoc.