mqtt_topic_engine/
error.rs1use thiserror::Error;
8
9#[cfg(feature = "router")]
10use crate::topic_matcher::TopicMatcherError;
11use crate::topic_pattern_item::TopicPatternError;
12use crate::topic_pattern_path::TopicFormatError;
13#[cfg(feature = "router")]
14use crate::topic_router::TopicRouterError;
15
16#[derive(Error, Debug, Clone, PartialEq, Eq)]
22pub enum TopicError {
23 #[error("Topic pattern error: {0}")]
25 Pattern(#[from] TopicPatternError),
26
27 #[error("Topic format error: {0}")]
29 Format(#[from] TopicFormatError),
30
31 #[cfg(feature = "router")]
33 #[error("Topic matcher error: {0}")]
34 Matcher(#[from] TopicMatcherError),
35
36 #[cfg(feature = "router")]
38 #[error("Topic router error: {0}")]
39 Router(#[from] TopicRouterError),
40}
41
42pub type TopicResult<T> = Result<T, TopicError>;
44
45pub type PatternResult<T> = Result<T, TopicPatternError>;
47
48#[cfg(feature = "router")]
50pub type MatcherResult<T> = Result<T, TopicMatcherError>;
51
52#[cfg(feature = "router")]
54pub type RouterResult<T> = Result<T, TopicRouterError>;