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" }
|
||||
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]
|
||||
|
|
|
@ -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<InvalidParamsDetail>,
|
||||
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<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)]
|
||||
pub struct Internal {
|
||||
pub message: String,
|
||||
|
@ -270,7 +258,7 @@ impl From<Error> 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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user