-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: surface underlying BigQueryException message in JDBC exceptions #12982
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -341,9 +341,9 @@ StatementType getStatementType(QueryJobConfiguration queryJobConfiguration) thro | |
| } catch (BigQueryException ex) { | ||
| if (ex.getMessage().contains("Syntax error")) { | ||
| throw new BigQueryJdbcSqlSyntaxErrorException( | ||
| "BigQueryException during getStatementType", ex); | ||
| "BigQueryException during getStatementType: " + ex.getMessage(), ex); | ||
| } | ||
| throw new BigQueryJdbcException("BigQueryException during getStatementType", ex); | ||
| throw new BigQueryJdbcException("BigQueryException during getStatementType: " + ex.getMessage(), ex); | ||
| } | ||
| QueryStatistics statistics = job.getStatistics(); | ||
| return statistics.getStatementType(); | ||
|
|
@@ -375,9 +375,9 @@ QueryStatistics getQueryStatistics(QueryJobConfiguration queryJobConfiguration) | |
| } catch (BigQueryException ex) { | ||
| if (ex.getMessage().contains("Syntax error")) { | ||
| throw new BigQueryJdbcSqlSyntaxErrorException( | ||
| "BigQueryException during getQueryStatistics", ex); | ||
| "BigQueryException during getQueryStatistics: " + ex.getMessage(), ex); | ||
| } | ||
| throw new BigQueryJdbcException("BigQueryException during getQueryStatistics", ex); | ||
| throw new BigQueryJdbcException("BigQueryException during getQueryStatistics: " + ex.getMessage(), ex); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -644,9 +644,9 @@ void runQuery(String query, QueryJobConfiguration jobConfiguration) | |
| throw new BigQueryJdbcRuntimeException("Interrupted during runQuery", ex); | ||
| } catch (BigQueryException ex) { | ||
| if (ex.getMessage().contains("Syntax error")) { | ||
| throw new BigQueryJdbcSqlSyntaxErrorException("BigQueryException during runQuery", ex); | ||
| throw new BigQueryJdbcSqlSyntaxErrorException("BigQueryException during runQuery: " + ex.getMessage(), ex); | ||
| } | ||
| throw new BigQueryJdbcException("BigQueryException during runQuery", ex); | ||
| throw new BigQueryJdbcException("BigQueryException during runQuery: " + ex.getMessage(), ex); | ||
|
Comment on lines
+647
to
+649
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes modify the error messages returned by the JDBC driver, which is a user-facing change. These changes should be accompanied by unit tests to verify that the underlying |
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for wrapping
BigQueryExceptionand surfacing its message is duplicated acrossgetStatementType,getQueryStatistics, andrunQuery. This duplication makes the code harder to maintain and increases the risk of inconsistencies. To align with repository practices, consider moving this shared logic to a separate helper or utility class.References