-
Notifications
You must be signed in to change notification settings - Fork 31
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
fix(spanner): convert enumerable GRPC::BadStatus errors to Google::Cloud::Errors #509
Comments
cc @dazuma |
So if I understand correctly, the conversion from :GRPC::BadStatus to ::Google::Cloud::Error happens for the regular requests but not for the paginated requests. gapic-generator-ruby/gapic-common/lib/gapic/paged_enumerable.rb Lines 128 to 133 in 1b1aaec
|
btw @thiagotnunes in your issue text the second 'here' hyperlink (for "The generated client is returning Enumerable as specified here") is the same as first and probably should be different? |
@viacheslav-rostovtsev thanks for taking a look at this. I think your understanding is correct. Thus, if we always converted from Thanks for pointing the wrong link. I fixed it to point to the correct block of code. |
TLDR: we would like to have the conversion of
GRPC::BadStatus
errors toGoogle::Cloud::Error
s in theEnumerable
result of streaming calls of the spanner client, so that the consumer only has to deal with one kind of error.We are currently observing a problem when calling the streaming calls in the spanner client
Google::Cloud::Spanner::V1::Client
where we have to handle bothGoogle::Cloud::Error
s andGRPC::Error
s.The generated client is rescuing
GRPC::BadStatus
and converting those toGoogle::Cloud::Error
s (like here). That is fine, because we can rely that if we get aGRPC::BadStatus
it will be automatically converted to us when executing the method.The problem lies in handling the result of streaming calls. The generated client is returning
Enumerable<PartialResultSet>
(as specified here). If we callresult.next
we might getGRPC::BadStatus
errors, because in this stream of results there is no conversion fromGRPC::BadStatus
errors toGoogle::Cloud::Error
s. This makes it a bit clunky to deal with the errors, where we have to deal with both flavours of the same errors.This problem is exemplified below:
We have identified this problem when fixing long PDML transactions in the ruby spanner client library (googleapis/google-cloud-ruby#7592).
The text was updated successfully, but these errors were encountered: