auths_core/proto.rs
1//! Protocol message types.
2
3use thiserror::Error;
4
5/// Protocol encoding and decoding errors.
6#[derive(Debug, Error)]
7pub enum ProtoError {
8 /// Unknown message type byte.
9 #[error("Invalid message type: {0}")]
10 InvalidMessageType(u8),
11
12 /// Message format is malformed.
13 #[error("Invalid message format: {0}")]
14 InvalidFormat(String),
15
16 /// A required field is absent.
17 #[error("Missing required field: {0}")]
18 MissingField(&'static str),
19
20 /// Protocol version is not supported.
21 #[error("Unsupported protocol version: {0}")]
22 UnsupportedVersion(u32),
23
24 /// Other protocol error.
25 #[error("Protocol error: {0}")]
26 Other(String),
27}