Skip to content

πŸ’€ Error Handling

At the heart of every rave, there are bouncers ensuring everything runs smoothly. Similarly, RaveRepository comes equipped with SqlRepositoryException, your custom unchecked exception to handle any hiccups during data interactions.

SqlRepositoryException

  • Usage: Thrown when there’s an issue with SQL queries or parameters.
  • Scenarios:
    • Missing SQL files.
    • Errors reading SQL scripts.
    • Invalid query parameters.

Example

public Raver getRaverById(int id) {
try {
return raveRepository.queryForObject(Raver.class, "id", id);
} catch (RaveRepository.SqlRepositoryException e) {
// Handle exception, maybe log the missed beat
logger.error("Failed to retrieve raver with ID: " + id, e);
throw e;
}
}