#[non_exhaustive]pub enum LastFmError {
Api {
method: String,
message: String,
error_code: u32,
retryable: bool,
},
RateLimited {
retry_after: Option<Duration>,
},
Network(Error),
Parse(Error),
Io(Error),
Csv(Error),
MissingEnvVar(String),
Config(String),
Http {
status: u16,
source: Option<Box<dyn Error + Send + Sync>>,
},
Url {
source: ParseError,
},
}Expand description
Errors that can occur when interacting with the Last.fm API
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Api
Represents a Last.fm API error with code and message
Access details via the struct fields: method, message, error_code, retryable
Fields
RateLimited
Represents rate limiting error
Access retry_after via the struct field
Network(Error)
Represents HTTP/network errors
Access source error via Error::source()
Parse(Error)
Represents JSON parsing errors
Access source error via Error::source()
Io(Error)
Represents file I/O errors
Access source error via Error::source()
Csv(Error)
Represents CSV errors
Access source error via Error::source()
MissingEnvVar(String)
Represents missing environment variable errors
Config(String)
Represents configuration errors
Http
Represents HTTP response errors (non-success status codes)
Fields
Url
Represents URL parsing errors
Fields
source: ParseErrorURL parse error
Implementations§
Source§impl LastFmError
impl LastFmError
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Check if this error is retryable
Sourcepub const fn retry_after(&self) -> Option<Duration>
pub const fn retry_after(&self) -> Option<Duration>
Get the retry delay if specified
Sourcepub fn api_method(&self) -> Option<&str>
pub fn api_method(&self) -> Option<&str>
Get the API method name if this is an API error
Sourcepub const fn api_error_code(&self) -> Option<u32>
pub const fn api_error_code(&self) -> Option<u32>
Get the API error code if this is an API error
Sourcepub fn api_message(&self) -> Option<&str>
pub fn api_message(&self) -> Option<&str>
Get the API error message if this is an API error
Sourcepub fn env_var_name(&self) -> Option<&str>
pub fn env_var_name(&self) -> Option<&str>
Get the environment variable name if this is a missing env var error
Sourcepub const fn http_status(&self) -> Option<u16>
pub const fn http_status(&self) -> Option<u16>
Get the HTTP status code if this is an HTTP error
Trait Implementations§
Source§impl Debug for LastFmError
impl Debug for LastFmError
Source§impl Display for LastFmError
impl Display for LastFmError
Source§impl Error for LastFmError
impl Error for LastFmError
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
use the Display impl or to_string()
Source§impl From<Error> for LastFmError
impl From<Error> for LastFmError
Source§impl From<Error> for LastFmError
impl From<Error> for LastFmError
Source§impl From<Error> for LastFmError
impl From<Error> for LastFmError
Source§impl From<Error> for LastFmError
impl From<Error> for LastFmError
Source§impl From<ParseError> for LastFmError
impl From<ParseError> for LastFmError
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for LastFmError
impl !RefUnwindSafe for LastFmError
impl Send for LastFmError
impl Sync for LastFmError
impl Unpin for LastFmError
impl UnsafeUnpin for LastFmError
impl !UnwindSafe for LastFmError
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.