pub enum ChoreographyError {
Show 22 variants
Transport(String),
Serialization(String),
ChannelSendFailed {
channel_type: &'static str,
reason: String,
},
ChannelClosed {
channel_type: &'static str,
operation: &'static str,
},
NoPeerChannel {
peer: String,
},
LabelSerializationFailed {
operation: &'static str,
reason: String,
},
MessageSerializationFailed {
operation: &'static str,
type_name: &'static str,
reason: String,
},
Timeout(Duration),
ProtocolViolation(String),
UnknownRole(String),
ProtocolContext {
protocol: &'static str,
role: &'static str,
phase: &'static str,
inner: Box<ChoreographyError>,
},
RoleContext {
role: &'static str,
index: Option<u32>,
inner: Box<ChoreographyError>,
},
MessageContext {
operation: &'static str,
message_type: &'static str,
direction: &'static str,
other_role: &'static str,
inner: Box<ChoreographyError>,
},
ChoiceError {
role: &'static str,
details: String,
},
WithContext {
context: String,
inner: Box<ChoreographyError>,
},
InvalidChoice {
expected: Vec<String>,
actual: String,
},
ExecutionError(String),
EmptyRoleFamily(String),
RoleFamilyNotFound(String),
InvalidRoleRange {
family: String,
start: u32,
end: u32,
},
InsufficientResponses {
expected: usize,
received: usize,
},
NotImplemented(String),
}Expand description
Errors that can occur during choreographic execution
Variants§
Transport(String)
Transport-layer error (network, channel failure, etc.)
Serialization(String)
Message serialization/deserialization error
ChannelSendFailed
Session transport send operation failed.
Fields
ChannelClosed
Session transport was closed unexpectedly during operation.
Fields
NoPeerChannel
No session registered for the specified peer.
LabelSerializationFailed
Label serialization failed during choice/offer
Fields
MessageSerializationFailed
Message serialization failed with type context
Fields
Timeout(Duration)
Operation exceeded the specified timeout
ProtocolViolation(String)
Protocol specification was violated at runtime
UnknownRole(String)
Referenced role not found in the choreography
ProtocolContext
Error with protocol execution context
Wraps an inner error with information about where in the protocol the error occurred (protocol name, role, phase).
Fields
inner: Box<ChoreographyError>The underlying error
RoleContext
Error with role-specific context
Fields
inner: Box<ChoreographyError>The underlying error
MessageContext
Error during message exchange with another role
Fields
inner: Box<ChoreographyError>The underlying error
ChoiceError
Error during choice/branch operation
Fields
WithContext
Generic wrapped error with context string
Fields
inner: Box<ChoreographyError>The underlying error
InvalidChoice
Invalid choice: the chosen branch was not among expected options
ExecutionError(String)
General execution error
EmptyRoleFamily(String)
Role family is empty after resolution
RoleFamilyNotFound(String)
Role family not found in adapter
InvalidRoleRange
Role range is invalid
Fields
InsufficientResponses
Insufficient responses received from role family
Fields
NotImplemented(String)
Feature not implemented
Implementations§
Source§impl ChoreographyError
impl ChoreographyError
Sourcepub fn with_protocol_context(
self,
protocol: &'static str,
role: &'static str,
phase: &'static str,
) -> Self
pub fn with_protocol_context( self, protocol: &'static str, role: &'static str, phase: &'static str, ) -> Self
Wrap this error with protocol context.
Sourcepub fn with_role_context(self, role: &'static str, index: Option<u32>) -> Self
pub fn with_role_context(self, role: &'static str, index: Option<u32>) -> Self
Wrap this error with role context.
Sourcepub fn with_message_context(
self,
operation: &'static str,
message_type: &'static str,
direction: &'static str,
other_role: &'static str,
) -> Self
pub fn with_message_context( self, operation: &'static str, message_type: &'static str, direction: &'static str, other_role: &'static str, ) -> Self
Wrap this error with message exchange context.
Sourcepub fn with_context(self, context: impl Into<String>) -> Self
pub fn with_context(self, context: impl Into<String>) -> Self
Wrap this error with a generic context string.
Sourcepub fn root_cause(&self) -> &ChoreographyError
pub fn root_cause(&self) -> &ChoreographyError
Get the root cause of the error (unwrapping all context layers).
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Check if this error is a timeout.
Sourcepub fn is_transport(&self) -> bool
pub fn is_transport(&self) -> bool
Check if this error is a transport error.
Sourcepub fn is_protocol_violation(&self) -> bool
pub fn is_protocol_violation(&self) -> bool
Check if this error is a protocol violation.
Sourcepub fn is_serialization(&self) -> bool
pub fn is_serialization(&self) -> bool
Check if this error is a serialization error.
Trait Implementations§
Source§impl Debug for ChoreographyError
impl Debug for ChoreographyError
Source§impl Display for ChoreographyError
impl Display for ChoreographyError
Source§impl Error for ChoreographyError
impl Error for ChoreographyError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()