diff --git a/src/protobuf/rpc.rs b/src/protobuf/rpc.rs index 04dcb2f..2150e09 100644 --- a/src/protobuf/rpc.rs +++ b/src/protobuf/rpc.rs @@ -1,9 +1,20 @@ +use std::fmt; #[derive(Clone, PartialEq, ::prost::Message)] pub struct Error { - #[prost(int32, tag="1")] - pub code: i32, - #[prost(string, optional, tag="2")] - pub message: ::core::option::Option<::prost::alloc::string::String>, - #[prost(bytes="vec", optional, tag="3")] - pub data: ::core::option::Option<::prost::alloc::vec::Vec>, + #[prost(int32, tag = "1")] + pub code: i32, + #[prost(string, optional, tag = "2")] + pub message: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bytes = "vec", optional, tag = "3")] + pub data: ::core::option::Option<::prost::alloc::vec::Vec>, +} + +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 + } }