Skip to content

fix(ado.net): translate SpannerException to SpannerDbException#772

Open
olavloite wants to merge 1 commit into
mainfrom
translate-sync-exceptions
Open

fix(ado.net): translate SpannerException to SpannerDbException#772
olavloite wants to merge 1 commit into
mainfrom
translate-sync-exceptions

Conversation

@olavloite

Copy link
Copy Markdown
Collaborator

Translate SpannerException to SpannerDbException for the sync code paths in SpannerDataReader, to ensure consistency between the sync and async methods.

@olavloite olavloite requested review from a team as code owners June 24, 2026 08:46

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

Copy link
Copy Markdown

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 adds exception translation to the Read, CheckForRows, and NextResult methods in SpannerDataReader, and introduces a new unit test to verify exception handling during both synchronous and asynchronous reads. The reviewer feedback suggests replacing the lambda-based exception translation with direct try-catch blocks to avoid unnecessary delegate allocations on hot paths. Additionally, the reviewer recommends marking the new test with the [NonParallelizable] attribute because it modifies global environment variables and state, which could cause flakiness when tests are run in parallel.

Comment thread spanner-ado-net/spanner-ado-net/SpannerDataReader.cs Outdated
Comment thread spanner-ado-net/spanner-ado-net/SpannerDataReader.cs Outdated
Comment thread spanner-ado-net/spanner-ado-net/SpannerDataReader.cs Outdated
Comment thread spanner-ado-net/spanner-ado-net-tests/ReaderTests.cs
Translate SpannerException to SpannerDbException for the sync code paths in
SpannerDataReader, to ensure consistency between the sync and async methods.
@olavloite olavloite force-pushed the translate-sync-exceptions branch from 089b247 to 164089c Compare June 24, 2026 09:41
@olavloite

Copy link
Copy Markdown
Collaborator Author

/gemini review

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

Copy link
Copy Markdown

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 introduces exception translation in SpannerDataReader for the Read, CheckForRows, and NextResult methods to ensure SpannerException is properly mapped to SpannerDbException, and adds a corresponding unit test. The feedback suggests refactoring these newly added try-catch blocks by utilizing an existing SpannerDbException.TranslateException helper overload that accepts a lambda, which would make the code cleaner and more maintainable.

Comment thread spanner-ado-net/spanner-ado-net/SpannerDataReader.cs
Comment thread spanner-ado-net/spanner-ado-net/SpannerDataReader.cs
Comment thread spanner-ado-net/spanner-ado-net/SpannerDataReader.cs
@olavloite olavloite requested a review from sakthivelmanii June 26, 2026 09:17
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