pub struct RpcErrorBody {
pub code: String,
pub message: String,
pub details: Option<Value>,
}Expand description
Wire shape of a single error returned by an RPC call. Maps from
CoolError via rpc_code + CoolError::public_message.
Fields§
§code: StringStable gRPC-style code: not_found, invalid_argument,
permission_denied, failed_precondition, conflict,
unauthenticated, internal.
message: StringPublic, safe-to-expose message.
details: Option<Value>Op-defined structured payload (e.g. validation issues).
Implementations§
Source§impl RpcErrorBody
impl RpcErrorBody
pub fn from_cool(error: &CoolError) -> RpcErrorBody
Sourcepub fn from_cool_response(response: CoolErrorResponse) -> RpcErrorBody
pub fn from_cool_response(response: CoolErrorResponse) -> RpcErrorBody
Translate a REST-style CoolErrorResponse into the RPC
error body. The code field is mapped from screaming-snake to
gRPC-style lowercase via cool_error_code_to_rpc_code;
message and details flow through verbatim.
Trait Implementations§
Source§impl Clone for RpcErrorBody
impl Clone for RpcErrorBody
Source§fn clone(&self) -> RpcErrorBody
fn clone(&self) -> RpcErrorBody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RpcErrorBody
impl Debug for RpcErrorBody
Source§impl<'de> Deserialize<'de> for RpcErrorBody
impl<'de> Deserialize<'de> for RpcErrorBody
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RpcErrorBody, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RpcErrorBody, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for RpcErrorBody
impl Serialize for RpcErrorBody
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for RpcErrorBody
impl RefUnwindSafe for RpcErrorBody
impl Send for RpcErrorBody
impl Sync for RpcErrorBody
impl Unpin for RpcErrorBody
impl UnsafeUnpin for RpcErrorBody
impl UnwindSafe for RpcErrorBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more