Skip to main content

clickhouse_cloud_api/
error.rs

1//! Error types for the ClickHouse Cloud API client.
2
3/// Errors that can occur when using the client.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    /// HTTP transport error.
7    #[error("HTTP error: {0}")]
8    Http(#[from] reqwest::Error),
9
10    /// JSON serialization/deserialization error.
11    #[error("JSON error: {0}")]
12    Json(#[from] serde_json::Error),
13
14    /// API returned an error response.
15    #[error("API error (status {status}): {message}")]
16    Api { status: u16, message: String },
17
18    /// Operation requires a different auth mode than the client was configured with.
19    #[error("auth mismatch: {0}")]
20    AuthMismatch(String),
21}