Skip to content

Add cause exception message to JDBC query failure message#12389

Merged
dain merged 1 commit intotrinodb:masterfrom
dain:improve-jdbc-error-message
May 14, 2022
Merged

Add cause exception message to JDBC query failure message#12389
dain merged 1 commit intotrinodb:masterfrom
dain:improve-jdbc-error-message

Conversation

@dain
Copy link
Copy Markdown
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
}
catch (RuntimeException e) {
throw new SQLException("Error executing query", e);
throw new SQLException("Error executing query: " + e.getMessage(), e);
Copy link
Copy Markdown
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