#[non_exhaustive]pub enum ExchangeError {
Http(Error),
WebSocket(Box<Error>),
Json(Error),
Api {
code: String,
message: String,
},
Auth(String),
Config(String),
Order(String),
WsDisconnected {
url: String,
attempts: u32,
},
InsufficientData(String),
Other(Error),
}Expand description
All errors that can be returned by exchange-apiws.
Marked #[non_exhaustive] so downstream match arms must include a
catch-all (_). This allows new variants to be added in minor releases
without breaking callers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Http(Error)
HTTP transport error from reqwest.
WebSocket(Box<Error>)
WebSocket transport error from tungstenite (boxed to reduce enum size).
Json(Error)
JSON serialization or deserialization error.
Api
The exchange returned a non-success response code.
Fields
Auth(String)
HMAC signing or credential validation failed.
Config(String)
A required configuration value is missing or invalid.
Order(String)
An order-level error (e.g. trying to close a flat position).
WsDisconnected
WebSocket feed gave up after exhausting all reconnect attempts.
Carries the WS URL and the number of attempts made so callers can log which feed died and how hard it tried.
Fields
InsufficientData(String)
Not enough historical data to complete the requested operation.
Other(Error)
Catch-all for errors from third-party libraries via anyhow.
Trait Implementations§
Source§impl Debug for ExchangeError
impl Debug for ExchangeError
Source§impl Display for ExchangeError
impl Display for ExchangeError
Source§impl Error for ExchangeError
impl Error for ExchangeError
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<Error> for ExchangeError
impl From<Error> for ExchangeError
Source§impl From<Error> for ExchangeError
impl From<Error> for ExchangeError
Source§impl From<Error> for ExchangeError
impl From<Error> for ExchangeError
Auto Trait Implementations§
impl Freeze for ExchangeError
impl !RefUnwindSafe for ExchangeError
impl Send for ExchangeError
impl Sync for ExchangeError
impl Unpin for ExchangeError
impl UnsafeUnpin for ExchangeError
impl !UnwindSafe for ExchangeError
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.