influxdb_stream/error.rs
1//! Error types for influxdb-stream.
2
3use thiserror::Error;
4
5/// Error type for influxdb-stream operations.
6#[derive(Error, Debug)]
7pub enum Error {
8 /// HTTP request failed.
9 #[error("HTTP request failed: {0}")]
10 Http(#[from] reqwest::Error),
11
12 /// Failed to serialize query to JSON.
13 #[error("Failed to serialize query: {0}")]
14 Serialization(#[from] serde_json::Error),
15
16 /// Failed to parse CSV data.
17 #[error("CSV parse error: {0}")]
18 Csv(String),
19
20 /// Failed to parse a value from the response.
21 #[error("Failed to parse value: {message}")]
22 Parse {
23 /// Description of what failed to parse.
24 message: String,
25 },
26
27 /// Unknown data type in annotated CSV.
28 #[error("Unknown data type: {0}")]
29 UnknownDataType(String),
30
31 /// Missing required annotation in CSV.
32 #[error("Missing annotation: {0}")]
33 MissingAnnotation(String),
34
35 /// Row has different number of columns than expected.
36 #[error("Column count mismatch: expected {expected}, got {actual}")]
37 ColumnMismatch {
38 /// Expected number of columns.
39 expected: usize,
40 /// Actual number of columns found.
41 actual: usize,
42 },
43
44 /// Query returned an error from InfluxDB.
45 #[error("Query error from InfluxDB: {message}")]
46 QueryError {
47 /// Error message returned by InfluxDB.
48 message: String,
49 /// Optional reference link for debugging.
50 reference: Option<String>,
51 },
52
53 /// I/O error during streaming.
54 #[error("I/O error: {0}")]
55 Io(#[from] std::io::Error),
56}
57
58/// Result type alias for influxdb-stream operations.
59pub type Result<T> = std::result::Result<T, Error>;