pub enum Error {
Transport(String),
Serde(Error),
Auth(String),
RateLimit {
endpoint: &'static str,
token_cost: u32,
retry_after_ms: Option<u64>,
message: String,
signer_limited: bool,
},
BadRequest(String),
BurstExceeded {
endpoint: &'static str,
token_cost: u32,
tier: String,
bucket: String,
burst: u32,
},
Exchange(String),
Timeout,
Decode(String),
Http {
status: u16,
message: String,
},
UrlParse(ParseError),
Io(Error),
}Expand description
Error type for Polymarket HTTP operations.
Variants§
Transport(String)
Serde(Error)
Auth(String)
RateLimit
Fields
BadRequest(String)
BurstExceeded
Exchange(String)
Timeout
Decode(String)
Http
UrlParse(ParseError)
Io(Error)
Implementations§
Source§impl Error
impl Error
pub fn transport(msg: impl Into<String>) -> Self
pub fn auth(msg: impl Into<String>) -> Self
pub fn rate_limit( endpoint: &'static str, token_cost: u32, retry_after_ms: Option<u64>, ) -> Self
pub fn rate_limit_response( endpoint: &'static str, token_cost: u32, retry_after_ms: Option<u64>, message: impl Into<String>, signer_limited: bool, ) -> Self
pub fn rate_limit_from_body( endpoint: &'static str, token_cost: u32, retry_after_ms: Option<u64>, body: &[u8], signer_limited: bool, ) -> Self
pub fn bad_request(msg: impl Into<String>) -> Self
pub fn exchange(msg: impl Into<String>) -> Self
pub fn decode(msg: impl Into<String>) -> Self
pub fn http(status: u16, message: impl Into<String>) -> Self
Sourcepub fn from_http_status(status: StatusCode, body: &[u8]) -> Self
pub fn from_http_status(status: StatusCode, body: &[u8]) -> Self
Classifies an HTTP status code and body into the appropriate error variant.
Sourcepub fn from_status_code(status: u16, body: &[u8]) -> Self
pub fn from_status_code(status: u16, body: &[u8]) -> Self
Classifies a raw status code (as u16) and body into the appropriate error variant.
Sourcepub fn from_reqwest(error: ReqwestError) -> Self
pub fn from_reqwest(error: ReqwestError) -> Self
Classifies a reqwest error into the appropriate error variant.
pub fn from_http_client(error: HttpClientError) -> Self
pub fn is_retryable(&self) -> bool
Sourcepub fn is_submit_outcome_unknown(&self) -> bool
pub fn is_submit_outcome_unknown(&self) -> bool
Returns true when a submit POST may have reached the venue but the
adapter cannot prove whether the venue accepted or rejected the order.
HTTP 425 and a 429 without CLOB signer-limiter headers stay unknown. A
429 is definitive only when Poly-RateLimit-Remaining,
Poly-RateLimit-Reset, or Poly-RateLimit-Tier is present.
pub fn is_rate_limited(&self) -> bool
pub fn retry_after(&self) -> Option<Duration>
pub fn is_auth_error(&self) -> bool
Sourcepub fn is_http_status_error(&self) -> bool
pub fn is_http_status_error(&self) -> bool
Returns true if this error originated from an HTTP status code response
(as opposed to transport, timeout, or local errors).
Sourcepub fn strategy_reason(&self) -> String
pub fn strategy_reason(&self) -> String
Returns a bounded reason suitable for strategy-facing rejection events.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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