peat_lite/protocol/error.rs
1//! Message encoding/decoding errors.
2
3/// Errors that can occur when encoding or decoding a Peat-Lite message.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum MessageError {
6 /// Output buffer is too small for the encoded message.
7 BufferTooSmall,
8 /// Input buffer is shorter than the minimum header size.
9 TooShort,
10 /// Magic bytes do not match.
11 InvalidMagic,
12 /// Protocol version is not supported.
13 UnsupportedVersion,
14 /// Message type byte is not recognised.
15 InvalidMessageType,
16 /// Payload exceeds `MAX_PAYLOAD_SIZE`.
17 PayloadTooLarge,
18}