pub enum Error {
Show 13 variants
Api {
code: i32,
message: String,
},
CancelReplace {
code: i32,
message: String,
data: Box<CancelReplaceErrorData>,
},
Http(Error),
Middleware(Error),
WebSocket(Error),
Serialization(Error),
UrlParse(ParseError),
InvalidConfig(String),
AuthenticationRequired,
SystemTime(SystemTimeError),
InvalidHeader(InvalidHeaderValue),
EnvVar(VarError),
InvalidCredentials(String),
}Expand description
Error types for the Binance client library.
Variants§
Api
Binance API returned an error response.
CancelReplace
Binance API returned a cancel-replace error response.
Http(Error)
HTTP request error.
Middleware(Error)
HTTP middleware error.
WebSocket(Error)
WebSocket error.
Serialization(Error)
JSON serialization/deserialization error.
UrlParse(ParseError)
URL parsing error.
InvalidConfig(String)
Invalid configuration.
AuthenticationRequired
Authentication is required but credentials were not provided.
SystemTime(SystemTimeError)
System time error (for timestamp generation).
InvalidHeader(InvalidHeaderValue)
Invalid header value.
EnvVar(VarError)
Environment variable error.
InvalidCredentials(String)
Invalid credentials (RSA/Ed25519 key parsing error).
Implementations§
Source§impl Error
impl Error
Sourcepub fn from_binance_error(error: BinanceApiError) -> Self
pub fn from_binance_error(error: BinanceApiError) -> Self
Create an API error from a Binance error response.
Sourcepub fn from_cancel_replace_error(error: CancelReplaceErrorResponse) -> Self
pub fn from_cancel_replace_error(error: CancelReplaceErrorResponse) -> Self
Create a cancel-replace error from a Binance error response.
Sourcepub fn is_rate_limit(&self) -> bool
pub fn is_rate_limit(&self) -> bool
Check if this is a rate limit error (code -1003).
Sourcepub fn is_invalid_signature(&self) -> bool
pub fn is_invalid_signature(&self) -> bool
Check if this is an invalid signature error (code -1022).
Sourcepub fn is_timestamp_error(&self) -> bool
pub fn is_timestamp_error(&self) -> bool
Check if this is a timestamp out of recv_window error (code -1021).
Check if this is an unauthorized error (code -1002 or -2015).
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
Source§impl From<InvalidHeaderValue> for Error
impl From<InvalidHeaderValue> for Error
Source§fn from(source: InvalidHeaderValue) -> Self
fn from(source: InvalidHeaderValue) -> Self
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Source§impl From<SystemTimeError> for Error
impl From<SystemTimeError> for Error
Source§fn from(source: SystemTimeError) -> Self
fn from(source: SystemTimeError) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe 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
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.