pub struct ProtocolError { /* private fields */ }Expand description
A safe, localizable protocol error payload.
Implementations§
Source§impl ProtocolError
impl ProtocolError
Sourcepub fn new(
code: AgentErrorCode,
message: impl Into<String>,
retry: RetryClass,
) -> Result<Self, ProtocolErrorValidationError>
pub fn new( code: AgentErrorCode, message: impl Into<String>, retry: RetryClass, ) -> Result<Self, ProtocolErrorValidationError>
Creates a validated protocol error without serializing an internal source chain.
§Errors
Returns an error when the technical message is empty, contains a null
character, or exceeds MAX_ERROR_MESSAGE_BYTES.
Sourcepub fn unsupported_command(correlation_id: CorrelationId) -> Self
pub fn unsupported_command(correlation_id: CorrelationId) -> Self
Creates the canonical unsupported-command error for protocol 1.x.
Sourcepub fn with_correlation_id(self, correlation_id: CorrelationId) -> Self
pub fn with_correlation_id(self, correlation_id: CorrelationId) -> Self
Adds a diagnostic correlation identifier.
Sourcepub fn with_details(self, details: ProtocolMetadata) -> Self
pub fn with_details(self, details: ProtocolMetadata) -> Self
Adds validated, bounded safe details.
Sourcepub const fn code(&self) -> AgentErrorCode
pub const fn code(&self) -> AgentErrorCode
Returns the stable error code.
Sourcepub const fn retry(&self) -> RetryClass
pub const fn retry(&self) -> RetryClass
Returns the retry classification.
Sourcepub const fn correlation_id(&self) -> Option<&CorrelationId>
pub const fn correlation_id(&self) -> Option<&CorrelationId>
Returns the optional diagnostic correlation identifier.
Sourcepub const fn details(&self) -> &ProtocolMetadata
pub const fn details(&self) -> &ProtocolMetadata
Returns bounded safe structured details.
Trait Implementations§
Source§impl Clone for ProtocolError
impl Clone for ProtocolError
Source§fn clone(&self) -> ProtocolError
fn clone(&self) -> ProtocolError
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 ProtocolError
impl Debug for ProtocolError
Source§impl<'de> Deserialize<'de> for ProtocolError
impl<'de> Deserialize<'de> for ProtocolError
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 PartialEq for ProtocolError
impl PartialEq for ProtocolError
Source§impl Serialize for ProtocolError
impl Serialize for ProtocolError
impl StructuralPartialEq for ProtocolError
Auto Trait Implementations§
impl Freeze for ProtocolError
impl RefUnwindSafe for ProtocolError
impl Send for ProtocolError
impl Sync for ProtocolError
impl Unpin for ProtocolError
impl UnsafeUnpin for ProtocolError
impl UnwindSafe for ProtocolError
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