Skip to content

chore(spanner): extract ErrorDetails from grpc-status-details-bin for raw gRPC exceptions#13320

Open
sakthivelmanii wants to merge 1 commit into
mainfrom
chore-spanner-error-details
Open

chore(spanner): extract ErrorDetails from grpc-status-details-bin for raw gRPC exceptions#13320
sakthivelmanii wants to merge 1 commit into
mainfrom
chore-spanner-error-details

Conversation

@sakthivelmanii
Copy link
Copy Markdown
Contributor

No description provided.

@sakthivelmanii sakthivelmanii requested review from a team as code owners June 1, 2026 15:55
@sakthivelmanii sakthivelmanii requested a review from olavloite June 1, 2026 15:55
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 enhances error detail extraction in SpannerException and SpannerExceptionFactory by supporting parsing of grpc-status-details-bin metadata from trailers. It also updates getRetryDelayInMillis, extractResourceInfo, and extractErrorInfo to leverage the centralized extractErrorDetails helper. A review comment points out a correctness bug in SpannerExceptionFactory.extractErrorDetails where the apiException parameter is completely unused, meaning error details from apiException are not extracted when cause is not a SpannerException.

Comment on lines 285 to 286
Throwable prevCause = null;
while (cause != null && cause != prevCause) {
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.

high

The apiException parameter passed to extractErrorDetails is currently completely unused in the method body. This leads to a correctness bug where error details are not extracted from the apiException when cause is not a SpannerException (for example, in extractErrorInfo).

We should check apiException at the beginning of the method and return its error details if present.

    if (apiException != null && apiException.getErrorDetails() != null) {
      return apiException.getErrorDetails();
    }
    Throwable prevCause = null;
    while (cause != null && cause != prevCause) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

apiException is used

@sakthivelmanii sakthivelmanii force-pushed the chore-spanner-error-details branch from 72f7ae2 to 817a544 Compare June 2, 2026 09:07
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