#[non_exhaustive]pub enum ClientError<AssetKey = AssetIndex, InstrumentKey = InstrumentIndex> {
Connectivity(ConnectivityError),
Api(ApiError<AssetKey, InstrumentKey>),
TaskFailed(String),
Internal(String),
Truncated {
limit: usize,
},
TruncatedSnapshot {
limit: usize,
},
}Expand description
Represents all errors produced by an ExecutionClient.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connectivity(ConnectivityError)
Connectivity based error.
eg/ Timeout.
Api(ApiError<AssetKey, InstrumentKey>)
API based error.
eg/ RateLimit.
TaskFailed(String)
A background task panicked or was cancelled during an operation.
This indicates a bug or unexpected runtime condition (e.g., a tokio
spawn_blocking task panicked). The operation was not retried and
the caller should treat this as non-recoverable, requiring operator
attention.
Internal(String)
An opaque error from an upstream library that cannot be further classified.
This is a catch-all for errors that don’t fit into Self::Connectivity or
Self::Api categories — typically because the upstream library (e.g., ibapi,
binance-sdk) returns unstructured errors.
Conservatively treated as non-transient. If you encounter this error frequently, consider filing an issue to improve error classification.
Truncated
Activity pagination was truncated at the page limit.
The returned data from the underlying call is a partial result. This error indicates that more activities exist beyond the safety limit, typically due to a very long outage (>5000 fills). Callers should alert operators and consider manual reconciliation.
TruncatedSnapshot
Open orders snapshot was truncated at the API’s row limit.
Unlike Self::Truncated (which applies to paginated activity fetches), this
error indicates a single-request endpoint hit its maximum row count.
Alpaca’s /v2/orders endpoint caps results at 500; accounts with more
concurrent open orders will have an incomplete snapshot.
Callers should alert operators — an incomplete order snapshot can cause duplicate submissions, missed cancellations, or incorrect position sizing.
Implementations§
Source§impl<AssetKey, InstrumentKey> ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> ClientError<AssetKey, InstrumentKey>
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns true if this error is likely transient and the operation
may succeed if retried after a suitable backoff.
The caller is responsible for retry limits and backoff strategy. This method classifies the error only — it does not implement policy.
§Transient errors
Connectivityerrors (timeout, socket, offline)Api::RateLimit
§Non-transient errors
- Other
Apierrors (invalid instrument, insufficient balance, etc.) TaskFailed(indicates a bug)Internal(unknown — conservatively non-transient)Truncated/TruncatedSnapshot
Trait Implementations§
Source§impl<AssetKey: Clone, InstrumentKey: Clone> Clone for ClientError<AssetKey, InstrumentKey>
impl<AssetKey: Clone, InstrumentKey: Clone> Clone for ClientError<AssetKey, InstrumentKey>
Source§fn clone(&self) -> ClientError<AssetKey, InstrumentKey>
fn clone(&self) -> ClientError<AssetKey, InstrumentKey>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, AssetKey, InstrumentKey> Deserialize<'de> for ClientError<AssetKey, InstrumentKey>where
AssetKey: Deserialize<'de>,
InstrumentKey: Deserialize<'de>,
impl<'de, AssetKey, InstrumentKey> Deserialize<'de> for ClientError<AssetKey, InstrumentKey>where
AssetKey: Deserialize<'de>,
InstrumentKey: Deserialize<'de>,
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>,
Source§impl<AssetKey, InstrumentKey> Display for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> Display for ClientError<AssetKey, InstrumentKey>
Source§impl<AssetKey, InstrumentKey> Error for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> Error for ClientError<AssetKey, InstrumentKey>
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()
Source§impl<AssetKey, InstrumentKey> From<ApiError<AssetKey, InstrumentKey>> for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> From<ApiError<AssetKey, InstrumentKey>> for ClientError<AssetKey, InstrumentKey>
Source§impl<AssetKey, InstrumentKey> From<ConnectivityError> for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> From<ConnectivityError> for ClientError<AssetKey, InstrumentKey>
Source§fn from(source: ConnectivityError) -> Self
fn from(source: ConnectivityError) -> Self
Source§impl<AssetKey: Ord, InstrumentKey: Ord> Ord for ClientError<AssetKey, InstrumentKey>
impl<AssetKey: Ord, InstrumentKey: Ord> Ord for ClientError<AssetKey, InstrumentKey>
Source§fn cmp(&self, other: &ClientError<AssetKey, InstrumentKey>) -> Ordering
fn cmp(&self, other: &ClientError<AssetKey, InstrumentKey>) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<AssetKey: PartialEq, InstrumentKey: PartialEq> PartialEq for ClientError<AssetKey, InstrumentKey>
impl<AssetKey: PartialEq, InstrumentKey: PartialEq> PartialEq for ClientError<AssetKey, InstrumentKey>
Source§fn eq(&self, other: &ClientError<AssetKey, InstrumentKey>) -> bool
fn eq(&self, other: &ClientError<AssetKey, InstrumentKey>) -> bool
self and other values to be equal, and is used by ==.Source§impl<AssetKey: PartialOrd, InstrumentKey: PartialOrd> PartialOrd for ClientError<AssetKey, InstrumentKey>
impl<AssetKey: PartialOrd, InstrumentKey: PartialOrd> PartialOrd for ClientError<AssetKey, InstrumentKey>
Source§impl<AssetKey, InstrumentKey> Serialize for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> Serialize for ClientError<AssetKey, InstrumentKey>
impl<AssetKey: Eq, InstrumentKey: Eq> Eq for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> StructuralPartialEq for ClientError<AssetKey, InstrumentKey>
Auto Trait Implementations§
impl<AssetKey, InstrumentKey> Freeze for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> RefUnwindSafe for ClientError<AssetKey, InstrumentKey>where
AssetKey: RefUnwindSafe,
InstrumentKey: RefUnwindSafe,
impl<AssetKey, InstrumentKey> Send for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> Sync for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> Unpin for ClientError<AssetKey, InstrumentKey>
impl<AssetKey, InstrumentKey> UnsafeUnpin for ClientError<AssetKey, InstrumentKey>where
AssetKey: UnsafeUnpin,
InstrumentKey: UnsafeUnpin,
impl<AssetKey, InstrumentKey> UnwindSafe for ClientError<AssetKey, InstrumentKey>where
AssetKey: UnwindSafe,
InstrumentKey: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more