display trait is added
This commit is contained in:
parent
8b28a1b19c
commit
e5f4b3c8c2
|
@ -1,9 +1,20 @@
|
||||||
|
use std::fmt;
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct Error {
|
pub struct Error {
|
||||||
#[prost(int32, tag="1")]
|
#[prost(int32, tag = "1")]
|
||||||
pub code: i32,
|
pub code: i32,
|
||||||
#[prost(string, optional, tag="2")]
|
#[prost(string, optional, tag = "2")]
|
||||||
pub message: ::core::option::Option<::prost::alloc::string::String>,
|
pub message: ::core::option::Option<::prost::alloc::string::String>,
|
||||||
#[prost(bytes="vec", optional, tag="3")]
|
#[prost(bytes = "vec", optional, tag = "3")]
|
||||||
pub data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
|
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
|
||||||
|
) // user-facing output
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user