Skip to content

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

Merged
LucioFranco merged 4 commits intohyperium:masterfrom
kyle-mccarthy:master
Aug 25, 2023
Merged

feat(tonic-types): add ability to extract rich error details from google.rpc.Status#1430
LucioFranco merged 4 commits intohyperium:masterfrom
kyle-mccarthy:master

Conversation

@kyle-mccarthy
Copy link
Copy Markdown
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
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.

2 participants