diff --git a/Cargo.toml b/Cargo.toml index a18e217..a7523ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ serde = { version = "1", features = ["derive"] } serde_json = { version = "1" } prost = { version = "0" } -beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.20-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.21-snapshot" } [build-dependencies] diff --git a/src/error/rpc.rs b/src/error/rpc.rs index 249a1d5..b8bca06 100644 --- a/src/error/rpc.rs +++ b/src/error/rpc.rs @@ -168,31 +168,19 @@ impl From<&InvalidParamsDetail> for bpr::protobuf::rpc::InvalidParamsDetail { #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct InvalidParams { pub message: String, - pub details: Vec, + pub detail: InvalidParamsDetail, } impl fmt::Display for InvalidParams { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, - "Invalid Params error, message: {}, details: {:?}", - self.message, self.details + "Invalid Params error, message: {}, detail: {:?}", + self.message, self.detail ) } } -impl From for bpr::protobuf::rpc::InvalidParams { - fn from(p: InvalidParams) -> Self { - bpr::protobuf::rpc::InvalidParams { - details: p - .details - .iter() - .map(bpr::protobuf::rpc::InvalidParamsDetail::from) - .collect(), - } - } -} - #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Internal { pub message: String, @@ -270,7 +258,7 @@ impl From for bpr::protobuf::rpc::Error { Error::InvalidParams(e) => bpr::protobuf::rpc::Error { code: -32602, message: e.message.clone(), - data: Some(bpr::protobuf::rpc::InvalidParams::from(e).encode_to_vec()), + data: Some(bpr::protobuf::rpc::InvalidParamsDetail::from(&e.detail).encode_to_vec()), }, Error::Internal(e) => bpr::protobuf::rpc::Error { code: -32603,