pub struct EnvelopeError {
pub code: String,
pub message: String,
pub hint: Option<String>,
pub details: Option<Value>,
}Expand description
Structured error rendered inside the JSON envelope’s error field.
Fields§
§code: String§message: String§hint: Option<String>§details: Option<Value>Implementations§
Source§impl EnvelopeError
impl EnvelopeError
Sourcepub fn new(code: impl Into<String>, message: impl Into<String>) -> EnvelopeError
pub fn new(code: impl Into<String>, message: impl Into<String>) -> EnvelopeError
Build an error with a code and message.
Sourcepub fn with_hint(self, hint: impl Into<String>) -> EnvelopeError
pub fn with_hint(self, hint: impl Into<String>) -> EnvelopeError
Attach an optional human-readable hint to the error.
Sourcepub fn with_details(self, details: Value) -> EnvelopeError
pub fn with_details(self, details: Value) -> EnvelopeError
Attach optional machine-readable structured detail to the error (e.g. the offending payload path).
Trait Implementations§
Source§impl Clone for EnvelopeError
impl Clone for EnvelopeError
Source§fn clone(&self) -> EnvelopeError
fn clone(&self) -> EnvelopeError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 EnvelopeError
impl Debug for EnvelopeError
Source§impl Serialize for EnvelopeError
impl Serialize for EnvelopeError
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 EnvelopeError
impl RefUnwindSafe for EnvelopeError
impl Send for EnvelopeError
impl Sync for EnvelopeError
impl Unpin for EnvelopeError
impl UnsafeUnpin for EnvelopeError
impl UnwindSafe for EnvelopeError
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