use std::{result::Result, time::Duration};
use thiserror::Error;
pub trait ExportError: std::error::Error + Send + Sync + 'static {
fn exporter_name(&self) -> &'static str;
}
#[derive(Error, Debug)]
pub enum OTelSdkError {
#[error("Shutdown already invoked")]
AlreadyShutdown,
#[error("Operation timed out after {0:?}")]
Timeout(Duration),
#[error("Operation failed: {0}")]
InternalFailure(String),
}
#[cfg(any(feature = "testing", test))]
impl<T> From<std::sync::PoisonError<T>> for OTelSdkError {
fn from(err: std::sync::PoisonError<T>) -> Self {
OTelSdkError::InternalFailure(format!("Mutex poison error: {err}"))
}
}
pub type OTelSdkResult = Result<(), OTelSdkError>;