chore(spanner): extract ErrorDetails from grpc-status-details-bin for raw gRPC exceptions#13320
chore(spanner): extract ErrorDetails from grpc-status-details-bin for raw gRPC exceptions#13320sakthivelmanii wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.
| Throwable prevCause = null; | ||
| while (cause != null && cause != prevCause) { |
There was a problem hiding this comment.
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) {There was a problem hiding this comment.
apiException is used
… raw gRPC exceptions
72f7ae2 to
817a544
Compare
No description provided.