#[non_exhaustive]pub enum CowError {
Types(CoreError),
Signing(SigningError),
AppData(AppDataError),
Contracts(ContractsError),
Orderbook(OrderbookError),
Trading(TradingError),
}Expand description
Aggregate error type for the root facade crate.
CowError is the convenience aggregate for consumers that ?-propagate
every SDK call into one type; each leaf error converts in through #[from].
A consumer with its own error type, or that needs rejection-specific
handling, can match the leaf error directly — every leaf exposes the same
ErrorClass through class() (and the orderbook and trading errors also
expose is_retryable() / backoff_hint()), so the verdict is identical
whether a caller holds the facade error or a bare leaf.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Types(CoreError)
Shared types, validation, or configuration error.
Signing(SigningError)
Signing or typed-data error.
AppData(AppDataError)
App-data generation, validation, or CID error.
Contracts(ContractsError)
Contract encoding, hashing, or provider interaction error.
Orderbook(OrderbookError)
Orderbook transport, decoding, or request error.
Trading(TradingError)
Trading workflow, quoting, or submission error.
Implementations§
Source§impl CowError
impl CowError
Sourcepub const fn class(&self) -> ErrorClass
pub const fn class(&self) -> ErrorClass
Returns the coarse-grained class for this error.
The classification is exhaustive: every supported variant resolves to
one of the ErrorClass buckets without falling through to a
default arm, so downstream telemetry layers can rely on the mapping
staying stable across releases.
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Returns true when retrying the same request may succeed.
The orderbook and trading errors carry the HTTP retry classification, so
the verdict delegates to their is_retryable() accessors; every other
facade variant is never retryable. Pair it with
CowError::backoff_hint for the suggested wait before the next
attempt.
Sourcepub fn backoff_hint(&self) -> Option<Duration>
pub fn backoff_hint(&self) -> Option<Duration>
Returns the server-suggested backoff before the next attempt, when the
failing orderbook response carried a Retry-After header.
Delegates to the orderbook and trading errors; returns None for
every other facade variant and for responses without a Retry-After
header.
Trait Implementations§
Source§impl Error for CowError
impl Error for CowError
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 From<AppDataError> for CowError
impl From<AppDataError> for CowError
Source§fn from(source: AppDataError) -> Self
fn from(source: AppDataError) -> Self
Source§impl From<ContractsError> for CowError
impl From<ContractsError> for CowError
Source§fn from(source: ContractsError) -> Self
fn from(source: ContractsError) -> Self
Source§impl From<OrderbookError> for CowError
impl From<OrderbookError> for CowError
Source§fn from(source: OrderbookError) -> Self
fn from(source: OrderbookError) -> Self
Source§impl From<SigningError> for CowError
impl From<SigningError> for CowError
Source§fn from(source: SigningError) -> Self
fn from(source: SigningError) -> Self
Source§impl From<TradingError> for CowError
impl From<TradingError> for CowError
Source§fn from(source: TradingError) -> Self
fn from(source: TradingError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for CowError
impl !UnwindSafe for CowError
impl Freeze for CowError
impl Send for CowError
impl Sync for CowError
impl Unpin for CowError
impl UnsafeUnpin for CowError
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> 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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.