You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have looked for existing issues (including closed) about this
Feature Request
GrpcCode does not provide the required From<T> implementations to easily be used over a tonic server that returns a tonic::Status with a tonic::Code. These logically are the same concept, but cannot be converted between these enums (and the numerical representaions) except by implementing your own matching logic.
Motivation
We are implementing a GrpcErrorsAsFailures for a tracing layer on top of a tonic server, and this returns a GrpcFailureClass::Code(NonZeroI32). It would be nice to have a simple path to convert this to a GrpcCode so we can leverage this in our tracing to get human-readable code strings.
The alternative is that users have to implement from_i32 or similar as methods themselves, which is potentially more error-prone than using a standard and common implementation, especially if gRPC status codes are changed in the future (such as to add new enumerated values for additional statuses).
The text was updated successfully, but these errors were encountered:
gshipilov
added a commit
to gshipilov/tower-http
that referenced
this issue
Aug 30, 2024
Feature Request
GrpcCode
does not provide the requiredFrom<T>
implementations to easily be used over atonic
server that returns atonic::Status
with atonic::Code
. These logically are the same concept, but cannot be converted between these enums (and the numerical representaions) except by implementing your own matching logic.Motivation
We are implementing a
GrpcErrorsAsFailures
for a tracing layer on top of atonic
server, and this returns aGrpcFailureClass::Code(NonZeroI32)
. It would be nice to have a simple path to convert this to aGrpcCode
so we can leverage this in our tracing to get human-readable code strings.Proposal
Similarly, if not identical, to
impl From<i32> for tonic::Code
.Alternatives
The alternative is that users have to implement
from_i32
or similar as methods themselves, which is potentially more error-prone than using a standard and common implementation, especially if gRPC status codes are changed in the future (such as to add new enumerated values for additional statuses).The text was updated successfully, but these errors were encountered: