2022-08-03 06:19:47 +00:00
|
|
|
use std::fmt;
|
2022-07-12 06:43:07 +00:00
|
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
|
|
pub struct Error {
|
2022-08-03 06:19:47 +00:00
|
|
|
#[prost(int32, tag = "1")]
|
|
|
|
pub code: i32,
|
2022-08-04 08:51:38 +00:00
|
|
|
#[prost(string, tag = "2")]
|
|
|
|
pub message: ::prost::alloc::string::String,
|
2022-08-03 06:19:47 +00:00
|
|
|
#[prost(bytes = "vec", optional, tag = "3")]
|
|
|
|
pub data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl fmt::Display for Error {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
|
|
write!(
|
|
|
|
f,
|
|
|
|
"Error code: {}, message: {:?}, data: {:?}",
|
|
|
|
self.code, self.message, self.data
|
2022-08-03 06:47:15 +00:00
|
|
|
)
|
2022-08-03 06:19:47 +00:00
|
|
|
}
|
2022-07-12 06:43:07 +00:00
|
|
|
}
|
2022-08-04 08:45:34 +00:00
|
|
|
|
|
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
|
|
pub struct InvalidParamsDetail {
|
|
|
|
#[prost(string, tag = "1")]
|
|
|
|
pub location: ::prost::alloc::string::String,
|
|
|
|
#[prost(string, tag = "2")]
|
|
|
|
pub param: ::prost::alloc::string::String,
|
|
|
|
#[prost(string, tag = "3")]
|
|
|
|
pub value: ::prost::alloc::string::String,
|
|
|
|
#[prost(enumeration = "InvalidParamsType", tag = "4")]
|
|
|
|
pub error_type: i32,
|
|
|
|
#[prost(string, tag = "5")]
|
|
|
|
pub message: ::prost::alloc::string::String,
|
|
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
|
|
#[repr(i32)]
|
|
|
|
pub enum InvalidParamsType {
|
2022-08-04 09:13:23 +00:00
|
|
|
None = 0,
|
|
|
|
DateTime = 1,
|
|
|
|
Decimal = 2,
|
|
|
|
EqualsTo = 3,
|
|
|
|
Float = 4,
|
|
|
|
Integer = 5,
|
|
|
|
Range = 6,
|
|
|
|
RegEx = 7,
|
|
|
|
Required = 8,
|
|
|
|
StringLength = 9,
|
|
|
|
Url = 10,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<i32> for InvalidParamsType {
|
|
|
|
fn from(s: i32) -> Self {
|
|
|
|
match s {
|
|
|
|
s if s == InvalidParamsType::DateTime as i32 => InvalidParamsType::DateTime,
|
|
|
|
s if s == InvalidParamsType::Decimal as i32 => InvalidParamsType::Decimal,
|
|
|
|
s if s == InvalidParamsType::EqualsTo as i32 => InvalidParamsType::EqualsTo,
|
|
|
|
s if s == InvalidParamsType::Float as i32 => InvalidParamsType::Float,
|
|
|
|
s if s == InvalidParamsType::Integer as i32 => InvalidParamsType::Integer,
|
|
|
|
s if s == InvalidParamsType::Range as i32 => InvalidParamsType::Range,
|
|
|
|
s if s == InvalidParamsType::RegEx as i32 => InvalidParamsType::RegEx,
|
|
|
|
s if s == InvalidParamsType::Required as i32 => InvalidParamsType::Required,
|
|
|
|
s if s == InvalidParamsType::StringLength as i32 => InvalidParamsType::StringLength,
|
|
|
|
s if s == InvalidParamsType::Url as i32 => InvalidParamsType::Url,
|
|
|
|
_ => InvalidParamsType::None,
|
|
|
|
}
|
|
|
|
}
|
2022-08-04 08:45:34 +00:00
|
|
|
}
|