-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(internal/retry): Simplify gRPC status code mapping of retry error #8196
fix(internal/retry): Simplify gRPC status code mapping of retry error #8196
Conversation
Thanks to @dfawley for suggesting this here: grpc/grpc-go#6374 (comment) |
800df30
to
017c367
Compare
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
gRPC v1.55.0 with a change in semantic for status.FromError such that the gRPC status of wrapped errors is returned when defined. The implementation of GRPCStatus in internal/retry code was doing just that. Removing GRPCStatus entirely makes the code much easier to understand: at the moment, status.FromError calls GRPCStatus which in turns calls status.FromError and it's not immediately obvious why this cannot result in infinite recursion. A previous change I made to this code made sure this method never returns status Code.OK (googleapis#8128), but I failed to realize that since this project depends on gRPC 1.55 that already handles wrapped errors in status.FromError, we can simply remove the implementation of `GRPCStatus` and let gRPC status.FromError handle unwrapping. Note that I barely had to change the tests, but there *IS* a slight change in behavior: the message of the wrapping error is included in the gRPC error. I think it's fine, bet let me know if you think otherwise (for the same reasons discussed in grpc/grpc-go#6150).
017c367
to
6a7ac3a
Compare
@noahdietz nope seems fine to me as well. Error strings are undefined behavior in my eyes -- at least for this instance. |
@atollena I'm updating your branch and will get it merged. I'll wait until the continuous integration tests pass upon merging to cut a release, but will ping you on the release when it happens. |
Thank you for merging. |
🤖 I have created a release *beep* *boop* --- ## [0.110.4](https://togithub.com/googleapis/google-cloud-go/compare/v0.110.3...v0.110.4) (2023-07-05) ### Bug Fixes * **internal/retry:** Simplify gRPC status code mapping of retry error ([#8196](https://togithub.com/googleapis/google-cloud-go/issues/8196)) ([e8b224a](https://togithub.com/googleapis/google-cloud-go/commit/e8b224a3bcb0ca9430990ef6ae8ddb7b60f5225d)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
gRPC v1.55.0 that this project depends on came with a change in semantic for status.FromError such that the gRPC status of wrapped errors is returned. The implementation of GRPCStatus in internal/retry code was doing just that. Removing GRPCStatus entirely makes the code much easier to understand: at the moment, status.FromError calls GRPCStatus which in turns calls status.FromError and it's not immediately obvious why this can't result in infinite recursion.
A previous change I made to this code made sure this method never returns Status.OK (#8128), but I failed to realize that since this project depends on gRPC 1.55 that already handles wrapped errors in status.FromError, we can simply remove the implementation of
GRPCStatus
and let gRPC status.FromError handle unwrapping.Note that I barely had to change the tests, but there IS a slight change in behavior: the message of the wrapping error is included in the gRPC error. I think it's fine, bet let me know if you think otherwise (for the same reasons discussed in grpc/grpc-go#6150).