pub struct ErrorBody {
pub code: String,
pub message: String,
pub detail: Option<Value>,
}Expand description
Canonical JSON body for all subc-generated ERROR frames.
detail is an optional machine-parsable surface for refusals whose remedy
needs more than a code (e.g. a producer-published backoff number, an
observed-vs-configured size pair). Absent detail serializes to nothing, so
bodies without it are byte-identical to the pre-detail wire and older
readers simply never see the field. Producers document each code’s detail
fields where the code is defined; detail must never carry secrets.
Fields§
§code: String§message: String§detail: Option<Value>Implementations§
Source§impl ErrorBody
impl ErrorBody
Sourcepub fn new(code: impl Into<String>, message: impl Into<String>) -> Self
pub fn new(code: impl Into<String>, message: impl Into<String>) -> Self
A detail-less error body; the common case.
Sourcepub fn with_detail(self, detail: Value) -> Self
pub fn with_detail(self, detail: Value) -> Self
Attach a machine-parsable detail object to this error.
Sourcepub fn module_reloading_for_daemon_upgrade(message: impl Into<String>) -> Self
pub fn module_reloading_for_daemon_upgrade(message: impl Into<String>) -> Self
A pre-send refusal while the daemon is upgrading or the target is waiting to resume. The rejected request never reached the module.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ErrorBody
impl<'de> Deserialize<'de> for ErrorBody
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ErrorBody
Auto Trait Implementations§
impl Forget for ErrorBody
impl Freeze for ErrorBodywhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
impl Move for ErrorBody
impl RefUnwindSafe for ErrorBody
impl Send for ErrorBody
impl Sync for ErrorBody
impl Unpin for ErrorBody
impl UnsafeUnpin for ErrorBodywhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
impl UnwindSafe for ErrorBody
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