Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgio Trettenero committed Dec 4, 2024
1 parent 6d5c382 commit fdb9a14
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,14 @@ public void delete(final ConnectorRequestContext context, final QualifiedName na
try {
this.polarisStoreService.deleteDatabase(name.getDatabaseName());
} catch (DataIntegrityViolationException exception) {
String message = exception.getMessage();
if (message.contains("violates foreign key constraint")
if (exception.getMessage().contains("violates foreign key constraint")
|| (exception.getCause() instanceof SQLException
&& "23503".equals(((SQLException) exception.getCause()).getSQLState()))) {

final String errorMessage = String.format(
"Failed to delete database %s due to foreign key constraint violation. "
+ "Ensure all dependent tables are removed first. Error: %s",
name, message
name, exception.getMessage()
);
throw new DatabasePreconditionFailedException(name, errorMessage, exception);
}
Expand Down

0 comments on commit fdb9a14

Please sign in to comment.