relaygate_protocol/
error.rs1#[derive(Debug, thiserror::Error)]
2pub enum ProtocolError {
3 #[error("frame I/O failed: {0}")]
4 Io(#[from] std::io::Error),
5 #[error("frame length {actual} exceeds configured maximum {maximum}")]
6 FrameTooLarge { actual: usize, maximum: usize },
7 #[error("unsupported protocol version {0}")]
8 UnsupportedVersion(u8),
9 #[error("invalid frame magic")]
10 InvalidMagic,
11 #[error("unknown frame kind {0}")]
12 UnknownFrameKind(u8),
13 #[error("unknown enum value {value} for {name}")]
14 UnknownEnum { name: &'static str, value: u8 },
15 #[error("truncated {0}")]
16 Truncated(&'static str),
17 #[error("invalid UTF-8 in {0}")]
18 InvalidUtf8(&'static str),
19 #[error("invalid Destination")]
20 InvalidDestination,
21 #[error("{field} is too long: {actual} bytes, maximum {maximum}")]
22 FieldTooLong {
23 field: &'static str,
24 actual: usize,
25 maximum: usize,
26 },
27 #[error("frame has {0} trailing bytes")]
28 TrailingBytes(usize),
29 #[error("frame length cannot be represented on the wire")]
30 LengthOverflow,
31}