use thiserror::Error;
#[cfg(feature = "router")]
use crate::topic_matcher::TopicMatcherError;
use crate::topic_pattern_item::TopicPatternError;
use crate::topic_pattern_path::TopicFormatError;
#[cfg(feature = "router")]
use crate::topic_router::TopicRouterError;
#[derive(Error, Debug, Clone, PartialEq, Eq)]
pub enum TopicError {
#[error("Topic pattern error: {0}")]
Pattern(#[from] TopicPatternError),
#[error("Topic format error: {0}")]
Format(#[from] TopicFormatError),
#[cfg(feature = "router")]
#[error("Topic matcher error: {0}")]
Matcher(#[from] TopicMatcherError),
#[cfg(feature = "router")]
#[error("Topic router error: {0}")]
Router(#[from] TopicRouterError),
}
pub type TopicResult<T> = Result<T, TopicError>;
pub type PatternResult<T> = Result<T, TopicPatternError>;
#[cfg(feature = "router")]
pub type MatcherResult<T> = Result<T, TopicMatcherError>;
#[cfg(feature = "router")]
pub type RouterResult<T> = Result<T, TopicRouterError>;