rustchain_client/error.rs
1//! Error types for the RustChain client.
2
3/// Errors that can occur when using the RustChain API client.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6 /// HTTP transport error (network, TLS, timeout, etc.).
7 #[error("HTTP error: {0}")]
8 Http(#[from] reqwest::Error),
9
10 /// The API returned a non-success status code.
11 #[error("API error (HTTP {status}): {message}")]
12 Api {
13 /// HTTP status code.
14 status: u16,
15 /// Response body or error message.
16 message: String,
17 },
18
19 /// Failed to parse JSON response.
20 #[error("JSON parse error: {0}")]
21 Json(#[from] serde_json::Error),
22}