-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy patherror.rs
35 lines (27 loc) · 1.05 KB
/
error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! Errors that might happen in the crate
use http::StatusCode;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("query is invalid: {error}")]
/// Error happens when a query is invalid
InvalidQueryError { error: String },
#[error("Failed to build URL: {error}")]
/// Error happens when a query is invalid
UrlConstructionError { error: String },
#[error("http protocol error: {error}")]
/// Error happens when a query is invalid
ProtocolError { error: String },
#[error("http protocol error: {error}")]
/// Error happens when Serde cannot deserialize the response
DeserializationError { error: String },
#[error("InfluxDB encountered the following error: {error}")]
/// Error which has happened inside InfluxDB
DatabaseError { error: String },
#[error("connection error: {error}")]
/// Error happens when HTTP request fails
ConnectionError { error: String },
#[cfg(feature = "reqwest")]
#[error("server responded with an error code: {0}")]
ApiError(StatusCode),
}