influxdb3_client/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Clone)]
5pub struct LineError {
6 pub line: u64,
8 pub message: String,
10 pub original_line: Option<String>,
12}
13
14impl std::fmt::Display for LineError {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 write!(f, "line {}: {}", self.line, self.message)
17 }
18}
19
20#[derive(Debug, Error)]
25#[error(
26 "partial write: {} line(s) rejected; first error: {}",
27 line_errors.len(),
28 line_errors.first().map(|e| e.message.as_str()).unwrap_or("unknown")
29)]
30pub struct PartialWriteError {
31 pub line_errors: Vec<LineError>,
32}
33
34#[derive(Debug, Error)]
36pub enum Error {
37 #[error("HTTP error: {0}")]
39 Http(#[from] reqwest::Error),
40
41 #[error("invalid URL: {0}")]
43 Url(#[from] url::ParseError),
44
45 #[error("JSON error: {0}")]
47 Json(#[from] serde_json::Error),
48
49 #[error("Arrow error: {0}")]
51 Arrow(#[from] arrow::error::ArrowError),
52
53 #[error("Flight gRPC error: {0}")]
55 Flight(#[from] tonic::Status),
56
57 #[error("gRPC transport error: {0}")]
59 Transport(#[from] tonic::transport::Error),
60
61 #[error("server error {code}: {message}")]
63 Server { code: u16, message: String },
64
65 #[error("operation timed out after {0:?}")]
67 Timeout(std::time::Duration),
68
69 #[error(transparent)]
71 PartialWrite(#[from] PartialWriteError),
72
73 #[error("configuration error: {0}")]
75 Config(String),
76
77 #[error("environment variable '{0}' is not set")]
79 EnvVar(String),
80}