pub struct WireError {
pub code: ErrorCode,
pub category: ErrorCategory,
pub message: Cow<'static, str>,
pub details: Option<Value>,
pub capability_hint: Option<CapabilityHint>,
}Expand description
Canonical wire error envelope.
Surfaces map this to their native format (RPC error, HTTP response, CLI exit).
Fields§
§code: ErrorCode§category: ErrorCategory§message: Cow<'static, str>§details: Option<Value>§capability_hint: Option<CapabilityHint>Implementations§
Source§impl WireError
impl WireError
Sourcepub fn new(code: ErrorCode, message: impl Into<Cow<'static, str>>) -> Self
pub fn new(code: ErrorCode, message: impl Into<Cow<'static, str>>) -> Self
Create a simple error with just a code and message.
Sourcepub fn with_capability_hint(self, hint: CapabilityHint) -> Self
pub fn with_capability_hint(self, hint: CapabilityHint) -> Self
Add a capability hint to this error.
Sourcepub fn with_details(self, details: Value) -> Self
pub fn with_details(self, details: Value) -> Self
Add details to this error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for WireError
impl<'de> Deserialize<'de> for WireError
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
Source§impl From<SessionError> for WireError
Convert from [SessionError] to WireError.
impl From<SessionError> for WireError
Convert from [SessionError] to WireError.
Source§fn from(err: SessionError) -> Self
fn from(err: SessionError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for WireError
impl RefUnwindSafe for WireError
impl Send for WireError
impl Sync for WireError
impl Unpin for WireError
impl UnsafeUnpin for WireError
impl UnwindSafe for WireError
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