pub enum BybitError {
Http(Error),
WebSocket(Box<Error>),
Timeout,
Api {
code: i32,
msg: String,
},
Parse(String),
MissingField(&'static str),
InvalidParam(String),
Auth(String),
}Expand description
The main error type for the Bybit API client.
All fallible operations return Result<T, BybitError>.
Variants§
Http(Error)
HTTP request failed (network error, timeout, etc.)
WebSocket(Box<Error>)
WebSocket error
Timeout
Request timed out
Api
Bybit API returned an error response
Parse(String)
Failed to parse response
MissingField(&'static str)
Missing required field in response
InvalidParam(String)
Invalid parameter provided
Auth(String)
Authentication error (missing or invalid credentials)
Implementations§
Source§impl BybitError
impl BybitError
Sourcepub fn api(code: i32, msg: impl Into<String>) -> Self
pub fn api(code: i32, msg: impl Into<String>) -> Self
Create an API error from code and message
Sourcepub fn invalid_param(msg: impl Into<String>) -> Self
pub fn invalid_param(msg: impl Into<String>) -> Self
Create an invalid parameter error
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Check if this is a rate limit error (code 10006)
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Check if this is a timeout error
Trait Implementations§
Source§impl Debug for BybitError
impl Debug for BybitError
Source§impl Display for BybitError
impl Display for BybitError
Source§impl Error for BybitError
impl Error for BybitError
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()
Auto Trait Implementations§
impl Freeze for BybitError
impl !RefUnwindSafe for BybitError
impl Send for BybitError
impl Sync for BybitError
impl Unpin for BybitError
impl UnsafeUnpin for BybitError
impl !UnwindSafe for BybitError
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
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.