Skip to content

feat: surface underlying BigQueryException message in JDBC exceptions#12982

Open
rhgoogle wants to merge 1 commit intogoogleapis:mainfrom
rhgoogle:feat/surface-exception-messages
Open

feat: surface underlying BigQueryException message in JDBC exceptions#12982
rhgoogle wants to merge 1 commit intogoogleapis:mainfrom
rhgoogle:feat/surface-exception-messages

Conversation

@rhgoogle
Copy link
Copy Markdown

@rhgoogle rhgoogle commented May 1, 2026

This PR surfaces the underlying BigQueryException message in JDBC exceptions to help debug issues in tools like Looker. Tested by verifying that the project compiles and the new strings are present in the built jar.

@rhgoogle rhgoogle requested review from a team as code owners May 1, 2026 23:39
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates BigQueryStatement.java to include the original BigQueryException message in the JDBC exceptions thrown by the getStatementType, getQueryStatistics, and runQuery methods. The review feedback suggests refactoring the duplicated exception-handling logic into a utility class to improve maintainability and recommends adding unit tests to verify the new error messages and handle edge cases like null or empty messages.

Comment on lines +344 to +346
"BigQueryException during getStatementType: " + ex.getMessage(), ex);
}
throw new BigQueryJdbcException("BigQueryException during getStatementType", ex);
throw new BigQueryJdbcException("BigQueryException during getStatementType: " + ex.getMessage(), ex);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The logic for wrapping BigQueryException and surfacing its message is duplicated across getStatementType, getQueryStatistics, and runQuery. 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
  1. If code is duplicated and needs to be shared, move it to a separate helper/utility class.

Comment on lines +647 to +649
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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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 BigQueryException message is correctly surfaced and that the logic handles edge cases (e.g., null or empty messages) gracefully. Relying on manual verification of the built JAR is insufficient for maintaining code quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant