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