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
22 /// The Query API reported the service is idled and asked for an explicit
23 /// wake confirmation (HTTP 206 `Confirm wake service`). Retry the query
24 /// with `wake_service` set to wake the service and run it.
25 #[error("service is idle; retry the query with wake_service to wake it")]
26 ServiceIdle,
27
28 /// The Query API reported the service is stopped (HTTP 206 `Service is
29 /// stopped`). A stopped service is never woken by the Query API; it must
30 /// be started explicitly.
31 #[error("service is stopped; it must be started before it can be queried")]
32 ServiceStopped,
33}