detail of InvalidParams is changed
This commit is contained in:
parent
e2136514b5
commit
a3afe66b5d
|
@ -14,7 +14,7 @@ serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = { version = "1" }
|
serde_json = { version = "1" }
|
||||||
prost = { version = "0" }
|
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]
|
[build-dependencies]
|
||||||
|
|
|
@ -168,31 +168,19 @@ impl From<&InvalidParamsDetail> for bpr::protobuf::rpc::InvalidParamsDetail {
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct InvalidParams {
|
pub struct InvalidParams {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
pub details: Vec<InvalidParamsDetail>,
|
pub detail: InvalidParamsDetail,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for InvalidParams {
|
impl fmt::Display for InvalidParams {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
"Invalid Params error, message: {}, details: {:?}",
|
"Invalid Params error, message: {}, detail: {:?}",
|
||||||
self.message, self.details
|
self.message, self.detail
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<InvalidParams> 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)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Internal {
|
pub struct Internal {
|
||||||
pub message: String,
|
pub message: String,
|
||||||
|
@ -270,7 +258,7 @@ impl From<Error> for bpr::protobuf::rpc::Error {
|
||||||
Error::InvalidParams(e) => bpr::protobuf::rpc::Error {
|
Error::InvalidParams(e) => bpr::protobuf::rpc::Error {
|
||||||
code: -32602,
|
code: -32602,
|
||||||
message: e.message.clone(),
|
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 {
|
Error::Internal(e) => bpr::protobuf::rpc::Error {
|
||||||
code: -32603,
|
code: -32603,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user