dns_message_parser/encode/
error.rs

1use crate::rr::APL_NEGATION_MASK;
2use thiserror::Error;
3
4#[derive(Debug, PartialEq, Error, Eq)]
5pub enum EncodeError {
6    #[error("String too big to be encoded as u8: {0}")]
7    String(usize),
8    #[error("Length too big to be encoded as u16: {0}")]
9    Length(usize),
10    #[error("Not enough bytes to set the data at the index: got {0} index {1}")]
11    NotEnoughBytes(usize, usize),
12    #[error("Could not compressed domain name, because offset is too large: {0}")]
13    Compression(u16),
14    #[error("Could not compressed domain name, because many recursions: {0}")]
15    MaxRecursion(usize),
16    #[error("Could not encode address length, because it is too big: {APL_NEGATION_MASK} <= {0}")]
17    APLAddressLength(u8),
18}