chore: rebrand project to crank
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
use thiserror::Error;
|
||||
use tonic::{
|
||||
Code, Status,
|
||||
metadata::errors::{InvalidMetadataKey, InvalidMetadataValue},
|
||||
};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GrpcAdapterError {
|
||||
#[error("invalid descriptor set encoding")]
|
||||
InvalidDescriptorEncoding,
|
||||
#[error("invalid descriptor set")]
|
||||
InvalidDescriptorSet,
|
||||
#[error("invalid descriptor pool")]
|
||||
InvalidDescriptorPool,
|
||||
#[error("service {service} was not found in descriptor set")]
|
||||
ServiceNotFound { service: String },
|
||||
#[error("method {method} was not found in service {service}")]
|
||||
MethodNotFound { service: String, method: String },
|
||||
#[error("grpc method path is invalid for service {service} and method {method}")]
|
||||
InvalidMethodPath { service: String, method: String },
|
||||
#[error("grpc method {service}/{method} is not unary")]
|
||||
UnsupportedMethodKind { service: String, method: String },
|
||||
#[error("invalid metadata key {key}")]
|
||||
InvalidMetadataKey {
|
||||
key: String,
|
||||
#[source]
|
||||
source: InvalidMetadataKey,
|
||||
},
|
||||
#[error("invalid metadata value for key {key}")]
|
||||
InvalidMetadataValue {
|
||||
key: String,
|
||||
#[source]
|
||||
source: InvalidMetadataValue,
|
||||
},
|
||||
#[error("transport endpoint is invalid")]
|
||||
InvalidEndpoint(#[from] tonic::transport::Error),
|
||||
#[error("grpc status {code}: {message}")]
|
||||
Status { code: Code, message: String },
|
||||
}
|
||||
|
||||
impl From<Status> for GrpcAdapterError {
|
||||
fn from(value: Status) -> Self {
|
||||
Self::Status {
|
||||
code: value.code(),
|
||||
message: value.message().to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user