cdk_prometheus/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in the Prometheus crate
4#[derive(Error, Debug)]
5pub enum PrometheusError {
6    /// Server binding error
7    #[error("Failed to bind to address {address}: {source}")]
8    ServerBind {
9        address: String,
10        #[source]
11        source: std::io::Error,
12    },
13
14    /// Metrics collection error
15    #[error("Failed to collect metrics: {0}")]
16    MetricsCollection(String),
17
18    /// Registry error
19    #[error("Registry error: {source}")]
20    Registry {
21        #[from]
22        source: prometheus::Error,
23    },
24
25    /// System metrics error
26    #[cfg(feature = "system-metrics")]
27    #[error("System metrics error: {0}")]
28    SystemMetrics(String),
29}
30
31/// Result type for Prometheus operations
32pub type Result<T> = std::result::Result<T, PrometheusError>;