pub enum XError {
AuthenticationFailed(String),
RateLimitExceeded {
retry_after: Option<u64>,
message: String,
},
InvalidRequest(String),
ApiError {
code: u16,
message: String,
},
NetworkError(Error),
JsonError(Error),
OAuthError(String),
Unknown(String),
}Expand description
Errors that can occur when using the X SDK
Variants§
AuthenticationFailed(String)
Authentication failed (401, 403)
RateLimitExceeded
Rate limit exceeded (429)
InvalidRequest(String)
Invalid request (400, 422)
ApiError
API error with status code and message
NetworkError(Error)
Network error from reqwest
JsonError(Error)
JSON serialization/deserialization error
OAuthError(String)
OAuth signature generation error
Unknown(String)
Unknown error
Implementations§
Source§impl XError
impl XError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if the error is retryable
Sourcepub fn retry_after(&self) -> Option<u64>
pub fn retry_after(&self) -> Option<u64>
Get retry delay in seconds if applicable
Trait Implementations§
Source§impl Error for XError
impl Error for XError
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 !RefUnwindSafe for XError
impl !UnwindSafe for XError
impl Freeze for XError
impl Send for XError
impl Sync for XError
impl Unpin for XError
impl UnsafeUnpin for XError
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