Skip to main content

highlevel_api/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("HTTP request failed: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("API error {status}: {message}")]
9    Api { status: u16, message: String },
10
11    #[error("Authentication error: {0}")]
12    Auth(String),
13
14    #[error("JSON error: {0}")]
15    Json(#[from] serde_json::Error),
16
17    #[error("URL parse error: {0}")]
18    Url(#[from] url::ParseError),
19
20    #[error("Missing required field: {0}")]
21    MissingField(String),
22}
23
24pub type Result<T> = std::result::Result<T, Error>;