use thiserror::Error;
#[derive(Error, Debug)]
pub enum PrometheusError {
#[error("Failed to bind to address {address}: {source}")]
ServerBind {
address: String,
#[source]
source: std::io::Error,
},
#[error("Failed to collect metrics: {0}")]
MetricsCollection(String),
#[error("Registry error: {source}")]
Registry {
#[from]
source: prometheus::Error,
},
#[cfg(feature = "system-metrics")]
#[error("System metrics error: {0}")]
SystemMetrics(String),
}
pub type Result<T> = std::result::Result<T, PrometheusError>;