krabka_telemetry/error.rs
1//! The error type that the OTLP pipeline build returns.
2//!
3//! The crate keeps one error enum here, so a caller matches a single type for a
4//! malformed configuration value and for an exporter build failure.
5
6/// An error from the build of the OTLP pipeline.
7///
8/// The error carries the exporter build failure. A misconfigured endpoint thus
9/// gives a clear message and does not become a silent no-export.
10#[derive(Debug, thiserror::Error)]
11pub enum TelemetryError {
12 #[error("invalid {name}: {message}")]
13 InvalidConfig { name: &'static str, message: String },
14 #[cfg(not(target_family = "wasm"))]
15 #[error("failed to build OTLP span exporter: {0}")]
16 Exporter(#[from] opentelemetry_otlp::ExporterBuildError),
17 /// The configuration asks for a capability that this platform does not
18 /// have, such as OTLP export on `wasm32-wasip1`.
19 #[cfg(target_family = "wasm")]
20 #[error("{what} is unavailable on this platform")]
21 Unsupported { what: &'static str },
22}