Skip to main content

auths_core/
proto.rs

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