We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f98dc1 commit 2f73b9aCopy full SHA for 2f73b9a
tower-http/src/classify/grpc_errors_as_failures.rs
@@ -70,6 +70,32 @@ impl GrpcCode {
70
}
71
72
73
+impl From<i32> for GrpcCode {
74
+ fn from(value: i32) -> Self {
75
+ match value {
76
+ 0 => GrpcCode::Ok,
77
+ 1 => GrpcCode::Cancelled,
78
+ 2 => GrpcCode::Unknown,
79
+ 3 => GrpcCode::InvalidArgument,
80
+ 4 => GrpcCode::DeadlineExceeded,
81
+ 5 => GrpcCode::NotFound,
82
+ 6 => GrpcCode::AlreadyExists,
83
+ 7 => GrpcCode::PermissionDenied,
84
+ 8 => GrpcCode::ResourceExhausted,
85
+ 9 => GrpcCode::FailedPrecondition,
86
+ 10 => GrpcCode::Aborted,
87
+ 11 => GrpcCode::OutOfRange,
88
+ 12 => GrpcCode::Unimplemented,
89
+ 13 => GrpcCode::Internal,
90
+ 14 => GrpcCode::Unavailable,
91
+ 15 => GrpcCode::DataLoss,
92
+ 16 => GrpcCode::Unauthenticated,
93
+
94
+ _ => GrpcCode::Unknown,
95
+ }
96
97
+}
98
99
bitflags! {
100
#[derive(Debug, Clone, Copy)]
101
pub(crate) struct GrpcCodeBitmask: u32 {
0 commit comments