Struct RpcErrorBody
pub struct RpcErrorBody {
pub code: String,
pub message: String,
pub details: Option<Value>,
pub extra: BTreeMap<String, Value>,
}Expand description
Wire shape of a single error returned by an RPC call. Maps from
[CratestackError] via rpc_code + [CratestackError::public_message].
Fields§
§code: StringStable gRPC-style code: not_found, invalid_argument,
permission_denied, failed_precondition, conflict,
unauthenticated, resource_exhausted (a rate-limit throttle,
cratestack#846), aborted (an @isolation transaction that ran out
of retries; safe to send again), unavailable, internal.
message: StringPublic, safe-to-expose message.
details: Option<Value>Op-defined structured payload (e.g. validation issues). Omitted on
the wire when None.
extra: BTreeMap<String, Value>Extra top-level members after code, message and details, set
by an AuthRefusal. Reserved names are never
written; a body read from the wire collects every member it does not
know here.
Implementations§
§impl RpcErrorBody
impl RpcErrorBody
pub fn from_cratestack(error: &CratestackError) -> RpcErrorBody
pub fn from_cratestack_response(
response: CratestackErrorResponse,
) -> RpcErrorBody
pub fn from_cratestack_response( response: CratestackErrorResponse, ) -> RpcErrorBody
Translate a REST-style [CratestackErrorResponse] into the RPC
error body. The code field is mapped from screaming-snake to
gRPC-style lowercase via [cratestack_error_code_to_rpc_code];
message, details and the extra members flow through verbatim.
Trait Implementations§
§impl Clone for RpcErrorBody
impl Clone for RpcErrorBody
§fn clone(&self) -> RpcErrorBody
fn clone(&self) -> RpcErrorBody
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for RpcErrorBody
impl Debug for RpcErrorBody
§impl Default for RpcErrorBody
impl Default for RpcErrorBody
§fn default() -> RpcErrorBody
fn default() -> RpcErrorBody
§impl<'de> Deserialize<'de> for RpcErrorBody
impl<'de> Deserialize<'de> for RpcErrorBody
§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>,
§impl PartialEq for RpcErrorBody
impl PartialEq for RpcErrorBody
§impl Serialize for RpcErrorBody
impl Serialize for RpcErrorBody
§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,
impl StructuralPartialEq for RpcErrorBody
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more