alpaca_http/
error.rs

1//! HTTP-specific error types.
2
3use alpaca_base::AlpacaError;
4use thiserror::Error;
5
6/// HTTP-specific errors for the Alpaca client.
7#[derive(Error, Debug)]
8pub enum HttpError {
9    /// Wrapped base Alpaca error.
10    #[error(transparent)]
11    Base(#[from] AlpacaError),
12
13    /// HTTP client errors.
14    #[error("HTTP client error: {0}")]
15    Client(#[from] reqwest::Error),
16
17    /// URL parsing errors.
18    #[error("URL parsing error: {0}")]
19    Url(#[from] url::ParseError),
20
21    /// Request timeout.
22    #[error("Request timeout")]
23    Timeout,
24
25    /// Too many requests (rate limited).
26    #[error("Rate limited: {0}")]
27    RateLimited(String),
28
29    /// Server error with status code and message.
30    #[error("Server error: {status} - {message}")]
31    Server {
32        /// HTTP status code.
33        status: u16,
34        /// Error message.
35        message: String,
36    },
37}