in src/main/java/com/google/gcs/sdrs/controller/BaseController.java [76:92]
protected Response errorResponse(Exception exception) {
HttpException outgoingException;
if (exception instanceof SQLException) {
logger.error(exception.getMessage());
outgoingException = new PersistenceException(exception);
} else if (exception instanceof IOException) {
outgoingException = new ServiceLayerException(exception);
} else if (exception instanceof EntityNotFoundException) {
outgoingException = new NotFoundException(exception.getMessage());
} else if (exception instanceof HttpException) {
outgoingException = (HttpException) exception;
} else {
logger.error("Unhandled internal error:", exception);
outgoingException = new InternalServerException(exception);
}
return generateExceptionResponse(outgoingException);
}