mqtt_channel_client/
errors.rs

1use crate::Event;
2
3/// Result type for MQTT errors.
4pub type Result<T> = std::result::Result<T, Error>;
5
6/// Error type for fallible operations in this crate.
7#[derive(Debug, thiserror::Error)]
8pub enum Error {
9    #[error("MQTT error")]
10    MqttError(#[from] paho_mqtt::Error),
11
12    #[error("Task join error")]
13    JoinError(#[from] tokio::task::JoinError),
14
15    #[error("Channel error")]
16    ChannelError(#[from] tokio::sync::broadcast::error::SendError<Event>),
17
18    #[error("Client was requested to start but is already started")]
19    ClientAlreadyStarted,
20
21    #[error("Client was requested to stop but is already stopped")]
22    ClientAlreadyStopped,
23}