#[non_exhaustive]pub enum RithmicError {
ConnectionFailed(String),
ConnectionClosed,
SendFailed,
EmptyResponse,
RequestRejected(RithmicRequestError),
ProtocolError(String),
InvalidArgument(String),
HeartbeatTimeout,
ForcedLogout(String),
}Expand description
Typed errors returned by all plant handle methods.
match handle.subscribe("ESH6", "CME").await {
Ok(resp) => { /* success */ }
Err(RithmicError::ConnectionClosed | RithmicError::SendFailed) => {
handle.abort();
// reconnect — see examples/reconnect.rs
}
Err(RithmicError::InvalidArgument(msg)) => eprintln!("bad input: {msg}"),
Err(RithmicError::RequestRejected(err)) => {
eprintln!(
"rejected code={} msg={}",
err.code.as_deref().unwrap_or("?"),
err.message.as_deref().unwrap_or(""),
);
}
Err(e) => eprintln!("{e}"),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ConnectionFailed(String)
WebSocket connection could not be established.
ConnectionClosed
The plant’s WebSocket connection is gone; pending requests will never complete.
SendFailed
WebSocket send failed or timed out after the request was registered.
Treat as a connection-health failure. This error alone does not prove the
actor has shut down; keep-alive failure detection can still emit
crate::rti::messages::RithmicMessage::HeartbeatTimeout or
crate::rti::messages::RithmicMessage::ConnectionError if the
connection is actually dead.
EmptyResponse
Server returned an empty response where at least one was expected.
RequestRejected(RithmicRequestError)
Structured protocol-level rejection preserving the Rithmic rp_code
tuple. Not a reconnect signal — request-level only.
ProtocolError(String)
Non-transport, non-rp_code response failure (e.g. decode failures or
other protocol-level outcomes that don’t carry rp_code). Not a
reconnect signal.
InvalidArgument(String)
A caller-supplied argument is invalid (the message describes which argument and why).
HeartbeatTimeout
Keep-alive detected the connection is dead.
ForcedLogout(String)
Server terminated the session with a reason string.
Implementations§
Source§impl RithmicError
impl RithmicError
Sourcepub fn is_connection_issue(&self) -> bool
pub fn is_connection_issue(&self) -> bool
Returns true when this error reflects a transport/connection-health failure rather than a protocol-level rejection.
Sourcepub fn as_connection_message(&self) -> RithmicMessage
pub fn as_connection_message(&self) -> RithmicMessage
Maps this error to the synthetic subscription RithmicMessage that a
connection-health broadcast should carry. HeartbeatTimeout preserves
the keep-alive signal; every other variant surfaces as ConnectionError.
Trait Implementations§
Source§impl Clone for RithmicError
impl Clone for RithmicError
Source§fn clone(&self) -> RithmicError
fn clone(&self) -> RithmicError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RithmicError
impl Debug for RithmicError
Source§impl Display for RithmicError
impl Display for RithmicError
Source§impl Error for RithmicError
impl Error for RithmicError
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()