pub enum FitbitError {
RequestError(Error),
JsonError(String),
RateLimitExceeded(u64),
AuthenticationError(String),
ApiError {
status_code: u16,
message: String,
},
ConfigurationError(String),
AccessTokenError(AccessTokenError),
}
Expand description
Errors that can occur when interacting with the Fitbit API
Variants§
RequestError(Error)
Error occurring during HTTP request
JsonError(String)
Error parsing JSON response
RateLimitExceeded(u64)
API rate limit exceeded
AuthenticationError(String)
Authentication error
ApiError
API responded with an error
ConfigurationError(String)
Client configuration error
AccessTokenError(AccessTokenError)
Error retrieving or using access token
Implementations§
Source§impl FitbitError
Helper functions for working with Fitbit errors
impl FitbitError
Helper functions for working with Fitbit errors
Sourcepub fn authentication_error(message: impl Into<String>) -> Self
pub fn authentication_error(message: impl Into<String>) -> Self
Sourcepub fn is_rate_limit(&self) -> bool
pub fn is_rate_limit(&self) -> bool
Checks if the error is a rate limit error
§Returns
true
if the error is a rate limit error, false
otherwise
Sourcepub fn is_authentication_error(&self) -> bool
pub fn is_authentication_error(&self) -> bool
Checks if the error is an authentication error
§Returns
true
if the error is an authentication error, false
otherwise
Sourcepub fn is_configuration_error(&self) -> bool
pub fn is_configuration_error(&self) -> bool
Checks if the error is a client configuration error
§Returns
true
if the error is a client configuration error, false
otherwise
Trait Implementations§
Source§impl Debug for FitbitError
impl Debug for FitbitError
Source§impl Display for FitbitError
impl Display for FitbitError
Source§impl Error for FitbitError
impl Error for FitbitError
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 From<AccessTokenError> for FitbitError
impl From<AccessTokenError> for FitbitError
Source§fn from(source: AccessTokenError) -> Self
fn from(source: AccessTokenError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for FitbitError
impl !RefUnwindSafe for FitbitError
impl Send for FitbitError
impl Sync for FitbitError
impl Unpin for FitbitError
impl !UnwindSafe for FitbitError
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