pub enum Error {
Transport(String),
Serde(Error),
Auth(String),
RateLimit {
scope: &'static str,
weight: u32,
retry_after_ms: Option<u64>,
},
BadRequest(String),
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
BadRequest(String)
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( scope: &'static str, weight: u32, retry_after_ms: Option<u64>, ) -> 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.
pub fn is_rate_limited(&self) -> bool
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).
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
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
Converts to this type from the input type.
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
Mutably borrows from an owned value. Read more
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>
§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>
Converts
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>
Converts
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