Skip to main content

gen_linkedin/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur when interacting with the LinkedIn API.
4#[derive(Debug, Error)]
5pub enum Error {
6    /// HTTP transport error from reqwest.
7    #[error("http error: {0}")]
8    Http(#[from] reqwest::Error),
9    /// Invalid or missing configuration.
10    #[error("invalid configuration: {0}")]
11    Config(String),
12    /// The LinkedIn API returned an error response.
13    #[error("api error: status={status}, message={message}")]
14    Api {
15        /// HTTP status code returned by the API.
16        status: u16,
17        /// Human-readable error message from the API.
18        message: String,
19    },
20    /// The request was rate limited; wait before retrying.
21    #[error("rate limited; retry after {retry_after}s")]
22    RateLimited {
23        /// Number of seconds to wait before retrying.
24        retry_after: u64,
25    },
26}