Skip to content
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

feat(tonic-types): add ability to extract rich error details from google.rpc.Status #1430

Merged
merged 4 commits into from Aug 25, 2023

Conversation

kyle-mccarthy
Copy link
Contributor

Motivation

The tonic-types crate allows for extracting rich error details from a tonic::Status through the StatusExt trait. It does this by decoding the bytes returned by tonic::Status into a google.rpc.Status. However, it does not allow for extracting the error details directly from a google.rpc.Status instance.

This can present a problem if a message contains an internal google.rpc.Status value, which seems to be fairly common on some GCP bidi streams. Example message:

message AppendRowsResponse {
  message AppendResult {
    // ..
  }

  oneof response {
    AppendResult append_result = 1;
    google.rpc.Status error = 2;
  }
  // ..
}

Solution

  • Provide From impls for converting between types defined in "std_messages" and the generated protobuf types.
  • Add trait that implements a subset of the StatusExt functionality for pb::Status
  • Update existing code to leverage conversions

@LucioFranco LucioFranco added this pull request to the merge queue Aug 25, 2023
Merged via the queue into hyperium:master with commit 5fd635a Aug 25, 2023
15 checks passed
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.

None yet

2 participants