Skip to main content

turbomcp_telemetry/
error.rs

1//! Telemetry error types
2
3use thiserror::Error;
4
5/// Errors that can occur during telemetry operations
6#[derive(Debug, Error)]
7pub enum TelemetryError {
8    /// Failed to initialize telemetry
9    #[error("Failed to initialize telemetry: {0}")]
10    InitializationFailed(String),
11
12    /// Invalid configuration
13    #[error("Invalid telemetry configuration: {0}")]
14    InvalidConfiguration(String),
15
16    /// Export failed
17    #[error("Failed to export telemetry data: {0}")]
18    ExportFailed(String),
19
20    /// Tracing subscriber error
21    #[error("Tracing subscriber error: {0}")]
22    TracingError(String),
23
24    /// OpenTelemetry error
25    #[cfg(feature = "opentelemetry")]
26    #[error("OpenTelemetry error: {0}")]
27    OpenTelemetryError(String),
28
29    /// Metrics error
30    #[cfg(feature = "prometheus")]
31    #[error("Metrics error: {0}")]
32    MetricsError(String),
33}
34
35/// Result type for telemetry operations
36pub type TelemetryResult<T> = Result<T, TelemetryError>;