use std::fmt; #[derive(Debug, Clone)] pub struct TelemetryError { message: String, } impl TelemetryError { pub fn new(message: impl Into) -> Self { Self { message: message.into(), } } pub fn exporter(error: impl fmt::Display) -> Self { Self::new(format!("exporter: {error}")) } pub fn shutdown(error: impl fmt::Display) -> Self { Self::new(format!("shutdown: {error}")) } } impl fmt::Display for TelemetryError { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str(&self.message) } } impl std::error::Error for TelemetryError {}