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,
11 #[source]
12 source: std::io::Error,
14 },
15
16 #[error("Failed to collect metrics: {0}")]
18 MetricsCollection(String),
19
20 #[error("Registry error: {source}")]
22 Registry {
23 #[from]
24 source: prometheus::Error,
26 },
27
28 #[cfg(feature = "system-metrics")]
30 #[error("System metrics error: {0}")]
31 SystemMetrics(String),
32}
33
34pub type Result<T> = std::result::Result<T, PrometheusError>;