#[non_exhaustive]pub enum O2Error {
Show 36 variants
InternalError(String),
InvalidRequest(String),
ParseError(String),
RateLimitExceeded(String),
GeoRestricted(String),
MarketNotFound(String),
MarketPaused(String),
MarketAlreadyExists(String),
OrderNotFound(String),
OrderNotActive(String),
InvalidOrderParams(String),
InvalidSignature(String),
InvalidSession(String),
AccountNotFound(String),
WhitelistNotConfigured(String),
TradeNotFound(String),
InvalidTradeCount(String),
AlreadySubscribed(String),
TooManySubscriptions(String),
SubscriptionError(String),
InvalidAmount(String),
InvalidTimeRange(String),
InvalidPagination(String),
NoActionsProvided(String),
TooManyActions(String),
BlockNotFound(String),
EventsNotFound(String),
OnChainRevert {
message: String,
reason: String,
receipts: Option<Value>,
},
SessionExpired(String),
HttpError(String),
WebSocketError(String),
WebSocketReconnected,
WebSocketDisconnected(String),
JsonError(String),
CryptoError(String),
Other(String),
}Expand description
The primary error type for the O2 SDK.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InternalError(String)
InvalidRequest(String)
ParseError(String)
RateLimitExceeded(String)
GeoRestricted(String)
MarketNotFound(String)
MarketPaused(String)
MarketAlreadyExists(String)
OrderNotFound(String)
OrderNotActive(String)
InvalidOrderParams(String)
InvalidSignature(String)
InvalidSession(String)
AccountNotFound(String)
WhitelistNotConfigured(String)
TradeNotFound(String)
InvalidTradeCount(String)
AlreadySubscribed(String)
TooManySubscriptions(String)
SubscriptionError(String)
InvalidAmount(String)
InvalidTimeRange(String)
InvalidPagination(String)
NoActionsProvided(String)
TooManyActions(String)
BlockNotFound(String)
EventsNotFound(String)
OnChainRevert
SessionExpired(String)
HttpError(String)
WebSocketError(String)
WebSocketReconnected
WebSocketDisconnected(String)
JsonError(String)
CryptoError(String)
Other(String)
Implementations§
Source§impl O2Error
impl O2Error
Sourcepub fn from_code(code: u32, message: String) -> Self
pub fn from_code(code: u32, message: String) -> Self
Create an O2Error from an API error code and message.
Sourcepub fn error_code(&self) -> Option<u32>
pub fn error_code(&self) -> Option<u32>
Returns the error code if this is a coded API error.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error suggests retrying with backoff.
Trait Implementations§
Source§impl Error for O2Error
impl Error for O2Error
1.30.0 · 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<Infallible> for O2Error
impl From<Infallible> for O2Error
Source§fn from(_: Infallible) -> Self
fn from(_: Infallible) -> Self
Converts to this type from the input type.
Source§impl From<ParseError> for O2Error
impl From<ParseError> for O2Error
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for O2Error
impl RefUnwindSafe for O2Error
impl Send for O2Error
impl Sync for O2Error
impl Unpin for O2Error
impl UnwindSafe for O2Error
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<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>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.