1#[derive(Debug, thiserror::Error)]
8pub enum MPacketHeaderError {
9 #[error("An invalid Quality of Service (Qos) was supplied: {}", .0)]
10 InvalidQualityOfService(u8),
11 #[error("An invalid packet type was supplied: {}", .0)]
12 InvalidPacketType(u8),
13 #[error("The DUP flag was set in a publish message of Quality of Service (QoS) level 0.")]
14 InvalidDupFlag,
15 #[error("The packet length does not fit the remaining length")]
16 InvalidPacketLength,
17 #[error("The client sent an unsupported protocol name: {}", .0)]
18 InvalidProtocolName(String),
19 #[error("The client sent an unsupported protocol level: {}", .0)]
20 InvalidProtocolLevel(u8),
21 #[error("Received a forbidden reserved value")]
22 ForbiddenReservedValue,
23 #[error("Received an invalid connect return code in CONNACK")]
24 InvalidConnectReturnCode(u8),
25 #[error("Received an invalid SUBACK")]
26 InvalidSubscriptionAck(u8),
27 #[error("The will flag and QoS are inconsistent")]
28 InconsistentWillFlag,
29}
30
31#[derive(Debug, thiserror::Error)]
32pub enum MPacketWriteError {
33 #[error("An IO error occurred")]
34 Io(#[from] std::io::Error),
35 #[error("An invalid packet size was constructed: {}", .0)]
36 InvalidSize(usize),
37}