Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMB-965: runSqlFile with failed Future on SQL failure #1118

Merged
merged 6 commits into from
Apr 6, 2023

Conversation

julianladisch
Copy link
Contributor

@julianladisch julianladisch commented Mar 26, 2023

The existing PostgresClient#runSQLFile methods return a succeeded Future when an SQL statement fails. The database failure messages are returned as a List of String.

This doesn't comply with the Future contract.

Add a PostgresClient#runSqlFile(String sqlFile) method that returns a failed Future when an SQL statement fails.

This simplifies code including RMB production and test code.

The existing PostgresClient#runSQLFile methods return a succeeded Future when an SQL statement fails. The database failure messages are returned as a List of String.

This doesn't comply with the Future contract.

Add a PostgresClient#runSqlFile(String sqlFile) method that returns a failed Future when an SQL statement fails.
asyncResultHandler.handle(io.vertx.core.Future.failedFuture(e.getMessage()));
log.error("{}", e.getMessage(), e);
asyncResultHandler.handle(Future.succeededFuture(
PostAdminImportSQLResponse.respond500WithTextPlain(e.getMessage())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree what you have here uses futures the right way. Also, it looks like this isn't a breaking change to modules that rely on this method. Do I have that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@sonarcloud
Copy link

sonarcloud bot commented Apr 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

93.5% 93.5% Coverage
0.0% 0.0% Duplication

@julianladisch julianladisch merged commit bf05db7 into master Apr 6, 2023
3 checks passed
@julianladisch julianladisch deleted the RMB-965-runSqlFile branch April 6, 2023 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants