RED-5504 - Prevent using exact same database schema/buckets/index for multiple tenants

- update the sql messages
This commit is contained in:
devplant 2023-04-06 16:34:26 +03:00
parent 76d264ec43
commit be0978a299

View File

@ -88,12 +88,14 @@ public class InternalControllerAdvice {
public ResponseEntity<ErrorMessage> handleSQLException(SQLException e) {
if (e.getMessage().contains("violates unique constraint")) {
return new ResponseEntity<>(new ErrorMessage(OffsetDateTime.now(), "Unique constraint violation"), HttpStatus.CONFLICT);
int index = e.getMessage().indexOf("violates unique constraint");
String violation_key = e.getMessage().substring(index);
return new ResponseEntity<>(new ErrorMessage(OffsetDateTime.now(), "Unique constraint violation" + violation_key), HttpStatus.CONFLICT);
} else if (e.getMessage().contains("No suitable driver found")) {
return new ResponseEntity<>(new ErrorMessage(OffsetDateTime.now(), "JDBC URL is incorrect"), HttpStatus.BAD_REQUEST);
} else {
log.error("PLSQL Exception occurred: {}", e.getMessage(), e);
return new ResponseEntity<>(new ErrorMessage(OffsetDateTime.now(), "SQL Exception"), HttpStatus.INTERNAL_SERVER_ERROR);
return new ResponseEntity<>(new ErrorMessage(OffsetDateTime.now(), "SQL Exception" + e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
}
}