bothan_lib/metrics/
utils.rs1use tonic::Code;
6
7pub fn code_to_str(code: Code) -> String {
17 match code {
18 Code::Ok => "ok".to_string(),
19 Code::Cancelled => "cancelled".to_string(),
20 Code::Unknown => "unknown".to_string(),
21 Code::InvalidArgument => "invalid_argument".to_string(),
22 Code::DeadlineExceeded => "deadline_exceeded".to_string(),
23 Code::NotFound => "not_found".to_string(),
24 Code::AlreadyExists => "already_exists".to_string(),
25 Code::PermissionDenied => "permission_denied".to_string(),
26 Code::ResourceExhausted => "resource_exhausted".to_string(),
27 Code::FailedPrecondition => "failed_precondition".to_string(),
28 Code::Aborted => "aborted".to_string(),
29 Code::OutOfRange => "out_of_range".to_string(),
30 Code::Unimplemented => "unimplemented".to_string(),
31 Code::Internal => "internal".to_string(),
32 Code::Unavailable => "unavailable".to_string(),
33 Code::DataLoss => "data_loss".to_string(),
34 Code::Unauthenticated => "unauthenticated".to_string(),
35 }
36}