#[non_exhaustive]pub enum ClobError {
Api(ApiError),
Crypto(String),
Alloy(String),
InvalidTickSize(ParseTickSizeError),
FakUnmatched {
message: String,
},
FokUnfilled {
message: String,
},
}Expand description
Error types for CLOB API operations.
#[non_exhaustive]: downstream matches must carry a wildcard arm. Polymarket
keeps introducing outcomes that are only distinguishable by prose (see
ClobError::FakUnmatched), so this enum will keep growing, and each new
variant should be a minor bump rather than a breaking one.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Api(ApiError)
Core API error
Crypto(String)
Cryptographic operation failed
Alloy(String)
Alloy (Ethereum library) error
InvalidTickSize(ParseTickSizeError)
Invalid tick size
FakUnmatched
A Fill-And-Kill order was killed because nothing on the book matched it.
This is FAK’s defined outcome, not a fault: the order was accepted, evaluated against the book, found no counterparty, and was killed exactly as its time-in-force specifies. It is reported as an error only because Polymarket returns it as HTTP 400, in the same bucket as malformed payloads and banned addresses.
It is deterministic — resubmitting the identical order cannot change the
answer — so ClobError::is_retriable returns false for it.
message carries the venue’s prose verbatim for logging. Match on the
variant, not on the text.
FokUnfilled
A Fill-Or-Kill order was killed because it could not be filled in full.
The FOK counterpart of ClobError::FakUnmatched, and equally a defined
outcome rather than a fault. Reached by crate::Clob::place_market_order,
which defaults to crate::OrderKind::Fok.
Implementations§
Source§impl ClobError
impl ClobError
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Whether re-sending the same request could plausibly produce a different result.
Delegates to ApiError::is_retriable for transport and HTTP failures.
The FAK/FOK kill outcomes and all local signing/encoding failures are
deterministic and return false.
let killed = ClobError::FakUnmatched { message: "no orders found to match".into() };
assert!(!killed.is_retriable());Trait Implementations§
Source§impl Error for ClobError
impl Error for ClobError
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<FromHexError> for ClobError
impl From<FromHexError> for ClobError
Source§fn from(err: FromHexError) -> Self
fn from(err: FromHexError) -> Self
Source§impl From<ParseError> for ClobError
impl From<ParseError> for ClobError
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Source§impl From<ParseTickSizeError> for ClobError
impl From<ParseTickSizeError> for ClobError
Source§fn from(source: ParseTickSizeError) -> Self
fn from(source: ParseTickSizeError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for ClobError
impl !UnwindSafe for ClobError
impl Freeze for ClobError
impl Send for ClobError
impl Sync for ClobError
impl Unpin for ClobError
impl UnsafeUnpin for ClobError
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> 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 moreSource§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.