fundamentum_sdk_mqtt/
error.rs

1//! Fundamentum Error
2//!
3
4use std::num::TryFromIntError;
5
6use displaydoc::Display;
7use tokio::sync::broadcast::error::SendError;
8
9use crate::message;
10
11/// Fundamentum iot core error
12#[derive(Display, Debug, thiserror::Error)]
13pub enum Error {
14    /// Failed to serialize/deserialize JWT: {0}
15    Jwt(#[from] jsonwebtoken::errors::Error),
16
17    /// Mqtt Connection Error: {0}
18    ConnectionError(#[from] rumqttc::v5::ConnectionError),
19
20    /// Mqtt Client Error: {0}
21    ClientError(#[from] rumqttc::v5::ClientError),
22
23    /// Failed to serialize/deserialize Mqtt option: {0}
24    MqttBytesError(#[from] rumqttc::mqttbytes::Error),
25
26    /// I/O Error: {0}
27    IoError(#[from] std::io::Error),
28
29    /// Error while sending packet inside incoming sender event: {0}
30    ErrorSendingIncomingEvent(#[from] SendError<message::Message>),
31
32    /// Failed to find properties inside packet
33    FailedToFindProperties,
34
35    /// Failed to get version, portforward message invalid
36    FailedToFindPortForwardingVersionProperties,
37
38    /// Failed to deserialize json: {0}
39    FailedToDeserializeJson(#[from] serde_json::Error),
40
41    /// Could not decode MQTT proto data: {0}
42    ProstDecode(#[from] prost::DecodeError),
43
44    /// Request received from cloud is invalid
45    InvalidRequest(String),
46
47    /// Failed to convert integer value: {0}
48    IntConversion(#[from] TryFromIntError),
49}