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

Add cause exception message to JDBC query failure message #12389

Merged
merged 1 commit into from
May 14, 2022

Conversation

dain
Copy link
Member

@dain dain commented May 13, 2022

Description

Improve error reporting in JDBC driver. Before the error message would just be Error executing query, and not it is Error executing query: <cause message>

Related issues, pull requests, and links

Documentation

(X) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

(X) No release notes entries required.
( ) Release notes entries required with the following suggested text:

@dain dain requested a review from electrum May 13, 2022 21:47
@cla-bot cla-bot bot added the cla-signed label May 13, 2022
@github-actions github-actions bot added the jdbc Relates to Trino JDBC driver label May 13, 2022
@dain dain merged commit dec155b into trinodb:master May 14, 2022
@dain dain deleted the improve-jdbc-error-message branch May 14, 2022 02:29
@github-actions github-actions bot added this to the 381 milestone May 14, 2022
@@ -284,7 +284,7 @@ final boolean internalExecute(String sql)
throw new SQLException(e.getMessage(), e);
}
catch (RuntimeException e) {
throw new SQLException("Error executing query", e);
throw new SQLException("Error executing query: " + e.getMessage(), e);
Copy link
Member

Choose a reason for hiding this comment

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

e.getMessage() may be null
in such case, it will look funny.

Suggested change
throw new SQLException("Error executing query: " + e.getMessage(), e);
throw new SQLException("Error executing query: " + firstNonNull(e.getMessage(), e), e);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed jdbc Relates to Trino JDBC driver
Development

Successfully merging this pull request may close these issues.

3 participants