pub enum QobuzApiError {
Show 15 variants
ApiErrorResponse {
code: String,
message: String,
status: String,
},
ApiResponseParseError {
content: String,
source: Error,
},
QobuzApiInitializationError {
message: String,
},
HttpError(Error),
IoError(Error),
LoftyError(LoftyError),
UrlError(ParseError),
AuthenticationError {
message: String,
},
CredentialsError {
message: String,
},
DownloadError {
message: String,
},
MetadataError {
source: Box<dyn Error + Send + Sync>,
},
ResourceNotFoundError {
resource_type: String,
resource_id: String,
},
RateLimitError {
message: String,
},
InvalidParameterError {
message: String,
},
UnexpectedApiResponseError {
message: String,
},
}Expand description
Custom error types for the Qobuz API Rust library.
This enum represents all possible errors that can occur when using the Qobuz API library. It includes errors from API responses, network operations, parsing, authentication, and more.
§Examples
use qobuz_api_rust::QobuzApiError;
fn handle_error(error: QobuzApiError) {
match error {
QobuzApiError::ApiErrorResponse { code, message, status } => {
eprintln!("API Error: {} - {} (Status: {})", code, message, status);
}
QobuzApiError::HttpError(e) => {
eprintln!("HTTP Error: {}", e);
}
_ => eprintln!("Other error occurred: {:?}", error),
}
}Variants§
ApiErrorResponse
Error response from the Qobuz API.
This variant represents an error response received from the Qobuz API itself, containing the error code, message, and status returned by the API.
§Fields
code- The error code returned by the APImessage- The error message provided by the APIstatus- The status string returned by the API
Fields
ApiResponseParseError
Error when parsing API response.
This variant represents an error that occurs when attempting to parse the response from the Qobuz API into a Rust data structure. It includes the original content that failed to parse and the underlying parsing error.
§Fields
content- The raw content that failed to parsesource- The underlying parsing error fromserde_json
Fields
QobuzApiInitializationError
Error during API initialization.
This variant represents an error that occurs during the initialization of the Qobuz API service, such as when failing to extract credentials from the web player or when required configuration is missing.
§Fields
message- A description of the initialization error
HttpError(Error)
HTTP request error.
This variant wraps errors from the reqwest crate that occur during
HTTP communication with the Qobuz API. This includes connection errors,
timeout errors, and other network-related issues.
IoError(Error)
Network/IO error.
This variant wraps errors from the standard library’s std::io::Error
that occur during network or file I/O operations, such as when downloading
tracks or reading local files.
LoftyError(LoftyError)
Lofty library error.
This variant wraps errors from the lofty crate that occur during
audio file metadata operations, such as reading, writing, or modifying tags.
This includes errors when reading from or saving to audio files.
UrlError(ParseError)
URL parsing error.
This variant wraps errors from the url crate that occur when parsing
or constructing URLs for API endpoints.
AuthenticationError
Authentication error.
This variant represents an error that occurs during authentication with the Qobuz API, such as invalid credentials or expired tokens.
§Fields
message- A description of the authentication error
CredentialsError
Error when credentials are missing or invalid.
This variant represents an error that occurs when required credentials (app ID, app secret, user token, etc.) are missing, empty, or invalid.
DownloadError
Error when downloading content.
This variant represents an error that occurs during content download operations, such as when downloading tracks, images, or other media files.
MetadataError
Error when processing metadata.
This variant represents an error that occurs during metadata extraction, embedding, or processing operations.
ResourceNotFoundError
Error when a required resource is not found.
This variant represents an error that occurs when a requested resource (track, album, artist, etc.) is not found in the Qobuz API.
Fields
RateLimitError
Error when a rate limit is exceeded.
This variant represents an error that occurs when the Qobuz API rate limit is exceeded, typically resulting in a 429 HTTP status code.
InvalidParameterError
Error when an invalid parameter is provided to an API call.
This variant represents an error that occurs when invalid or unsupported parameters are passed to an API endpoint.
UnexpectedApiResponseError
Error when the API returns an unexpected response format.
This variant represents an error that occurs when the API returns a response that doesn’t match the expected format, indicating a potential API change or bug.
Trait Implementations§
Source§impl Debug for QobuzApiError
impl Debug for QobuzApiError
Source§impl Display for QobuzApiError
impl Display for QobuzApiError
Source§impl Error for QobuzApiError
impl Error for QobuzApiError
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
Source§impl From<Error> for QobuzApiError
impl From<Error> for QobuzApiError
Source§impl From<Error> for QobuzApiError
impl From<Error> for QobuzApiError
Source§impl From<LoftyError> for QobuzApiError
impl From<LoftyError> for QobuzApiError
Source§fn from(source: LoftyError) -> Self
fn from(source: LoftyError) -> Self
Source§impl From<ParseError> for QobuzApiError
impl From<ParseError> for QobuzApiError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for QobuzApiError
impl !RefUnwindSafe for QobuzApiError
impl Send for QobuzApiError
impl Sync for QobuzApiError
impl Unpin for QobuzApiError
impl !UnwindSafe for QobuzApiError
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.