Skip to main content

ChoreographyError

Enum ChoreographyError 

Source
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

§channel_type: &'static str

Type of session transport (for example “SinkStream”)

§reason: String

Human-readable failure reason

§

ChannelClosed

Session transport was closed unexpectedly during operation.

Fields

§channel_type: &'static str

Type of session transport (for example “SinkStream”)

§operation: &'static str

Operation being performed when channel closed

§

NoPeerChannel

No session registered for the specified peer.

Fields

§peer: String

String representation of the peer role

§

LabelSerializationFailed

Label serialization failed during choice/offer

Fields

§operation: &'static str

Operation: “serialization” or “deserialization”

§reason: String

Human-readable failure reason

§

MessageSerializationFailed

Message serialization failed with type context

Fields

§operation: &'static str

Operation: “Serialization” or “Deserialization”

§type_name: &'static str

Name of the type being serialized

§reason: String

Human-readable failure reason

§

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

§protocol: &'static str

Name of the protocol being executed

§role: &'static str

Name of the role executing when error occurred

§phase: &'static str

Current phase/step in the protocol

§inner: Box<ChoreographyError>

The underlying error

§

RoleContext

Error with role-specific context

Fields

§role: &'static str

Name of the role where error occurred

§index: Option<u32>

Optional role index for parameterized roles

§inner: Box<ChoreographyError>

The underlying error

§

MessageContext

Error during message exchange with another role

Fields

§operation: &'static str

The operation being performed (send/recv)

§message_type: &'static str

The type of message involved

§direction: &'static str

Direction (to/from)

§other_role: &'static str

The other role involved in the exchange

§inner: Box<ChoreographyError>

The underlying error

§

ChoiceError

Error during choice/branch operation

Fields

§role: &'static str

The role making or receiving the choice

§details: String

Details about the choice error

§

WithContext

Generic wrapped error with context string

Fields

§context: String

Additional context about the error

§inner: Box<ChoreographyError>

The underlying error

§

InvalidChoice

Invalid choice: the chosen branch was not among expected options

Fields

§expected: Vec<String>

Expected branch labels

§actual: String

Actual branch label provided

§

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

§family: String

The role family name

§start: u32

Range start (inclusive)

§end: u32

Range end (exclusive)

§

InsufficientResponses

Insufficient responses received from role family

Fields

§expected: usize

Expected minimum number of responses

§received: usize

Actual number of responses received

§

NotImplemented(String)

Feature not implemented

Implementations§

Source§

impl ChoreographyError

Source

pub fn with_protocol_context( self, protocol: &'static str, role: &'static str, phase: &'static str, ) -> Self

Wrap this error with protocol context.

Source

pub fn with_role_context(self, role: &'static str, index: Option<u32>) -> Self

Wrap this error with role context.

Source

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.

Source

pub fn with_context(self, context: impl Into<String>) -> Self

Wrap this error with a generic context string.

Source

pub fn root_cause(&self) -> &ChoreographyError

Get the root cause of the error (unwrapping all context layers).

Source

pub fn is_timeout(&self) -> bool

Check if this error is a timeout.

Source

pub fn is_transport(&self) -> bool

Check if this error is a transport error.

Source

pub fn is_protocol_violation(&self) -> bool

Check if this error is a protocol violation.

Source

pub fn is_serialization(&self) -> bool

Check if this error is a serialization error.

Trait Implementations§

Source§

impl Debug for ChoreographyError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ChoreographyError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ChoreographyError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> Endpoint for T
where T: Send,