Skip to main content

finance_query_core/client/
error.rs

1//! Error types for Yahoo Finance client operations.
2//!
3//! This module provides framework-agnostic error types that can be used
4//! in any Rust application without web framework dependencies.
5
6/// Error type for Yahoo Finance client operations.
7///
8/// This enum represents all possible errors that can occur when
9/// interacting with the Yahoo Finance API.
10#[derive(Debug, thiserror::Error)]
11pub enum YahooError {
12    /// Authentication with Yahoo Finance failed.
13    #[error("Authentication failed: {0}")]
14    AuthFailed(String),
15
16    /// The requested resource was not found.
17    #[error("Resource not found: {0}")]
18    NotFound(String),
19
20    /// Rate limit has been exceeded.
21    #[error("Rate limit exceeded")]
22    RateLimited,
23
24    /// HTTP error with status code and message.
25    #[error("HTTP error: {0}")]
26    HttpError(u16, String),
27
28    /// Failed to parse response data.
29    #[error("Parse error: {0}")]
30    ParseError(String),
31
32    /// Network-level error from reqwest.
33    #[error("Network error: {0}")]
34    NetworkError(#[from] reqwest::Error),
35}