1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum PrometheusError {
6 #[error("Failed to bind to address {address}: {source}")]
8 ServerBind {
9 address: String,
10 #[source]
11 source: std::io::Error,
12 },
13
14 #[error("Failed to collect metrics: {0}")]
16 MetricsCollection(String),
17
18 #[error("Registry error: {source}")]
20 Registry {
21 #[from]
22 source: prometheus::Error,
23 },
24
25 #[cfg(feature = "system-metrics")]
27 #[error("System metrics error: {0}")]
28 SystemMetrics(String),
29}
30
31pub type Result<T> = std::result::Result<T, PrometheusError>;