prometheus_http_client/
error.rs

1//! Error types for prom-client
2
3use displaydoc::Display;
4use url::ParseError;
5
6/// Errors that can occur when making Prometheus API requests
7#[derive(Debug, Display)]
8pub enum Error {
9    /// URL: {0}
10    Url(ParseError),
11    /// Reqwest: {0}
12    Reqwest(reqwest::Error),
13    /// API: {0}: {1}
14    API(String, String),
15    /// Unexpected Result Type: {0}
16    UnexpectedResultType(String),
17    /// Missing data on success response
18    MissingData,
19}
20
21impl From<reqwest::Error> for Error {
22    fn from(src: reqwest::Error) -> Self {
23        Self::Reqwest(src)
24    }
25}
26
27impl From<ParseError> for Error {
28    fn from(src: ParseError) -> Self {
29        Self::Url(src)
30    }
31}
32
33impl std::error::Error for Error {}