pub struct ClientError {
pub message: String,
pub code: u16,
pub rate_limit: Option<RateLimitError>,
}Expand description
Error type returned by the XYO SDK client.
Fields§
§message: String§code: u16§rate_limit: Option<RateLimitError>Implementations§
Source§impl ClientError
impl ClientError
Sourcepub fn new(code: u16, message: impl Into<String>) -> Self
pub fn new(code: u16, message: impl Into<String>) -> Self
Construct a new ClientError without rate limit details.
Sourcepub fn with_rate_limit(
code: u16,
message: impl Into<String>,
rate_limit: RateLimitError,
) -> Self
pub fn with_rate_limit( code: u16, message: impl Into<String>, rate_limit: RateLimitError, ) -> Self
Construct a new ClientError with rate limit details.
Sourcepub fn is_auth(&self) -> bool
pub fn is_auth(&self) -> bool
Returns true if this error represents an authentication or authorization failure (HTTP 401 or 403).
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Returns true if this error represents a rate limit or throttle (HTTP 429).
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if this error represents a resource not found (HTTP 404).
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Returns true if this error represents an internal server error (HTTP 5xx).
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if the operation is transient and safe to retry.
Trait Implementations§
Source§impl Clone for ClientError
impl Clone for ClientError
Source§fn clone(&self) -> ClientError
fn clone(&self) -> ClientError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClientError
impl Debug for ClientError
Source§impl Display for ClientError
impl Display for ClientError
impl Eq for ClientError
Source§impl Error for ClientError
impl Error for ClientError
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 PartialEq for ClientError
impl PartialEq for ClientError
impl StructuralPartialEq for ClientError
Auto Trait Implementations§
impl Freeze for ClientError
impl RefUnwindSafe for ClientError
impl Send for ClientError
impl Sync for ClientError
impl Unpin for ClientError
impl UnsafeUnpin for ClientError
impl UnwindSafe for ClientError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.