use thiserror::Error;
pub type LoggingResult<T> = Result<T, LoggingError>;
#[derive(Error, Debug)]
pub enum LoggingError {
#[error("NATS error: {0}")]
Nats(#[from] async_nats::Error),
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("Configuration error: {0}")]
Config(String),
#[error("Rate limit exceeded")]
RateLimitExceeded,
#[error("Log buffer overflow")]
BufferOverflow,
#[error("Operation timed out")]
Timeout,
#[error("Logging error: {0}")]
Generic(String),
}
impl From<&str> for LoggingError {
fn from(s: &str) -> Self {
LoggingError::Generic(s.to_string())
}
}
impl From<String> for LoggingError {
fn from(s: String) -> Self {
LoggingError::Generic(s)
}
}