1use thiserror::Error;
2
3use crate::constants::PDU_HEADER_LEN_BYTES;
4
5#[derive(Debug, PartialEq, Eq, Error)]
6pub enum DisError {
7 #[error("{0}")]
9 ParseError(String), #[error("The buffer does not contain enough bytes for a valid DIS header. {0} bytes available, needed {PDU_HEADER_LEN_BYTES}")]
11 InsufficientHeaderLength(u16), #[error("PDU has insufficient length. Expected {0}, found {1}")]
13 InsufficientPduLength(u16, u16), #[error("PDU is larger than size of the buffer for serialisation. Needs {0} bytes, available {1} bytes")]
15 InsufficientBufferSize(u16, usize), #[error("Provided String is not valid ASCII encoded.")]
17 StringNotAsciiError, #[error("Provided String is too long.")]
19 StringTooLongError, #[error("IFF PDU - Incorrect System Time provided.")]
21 IffIncorrectSystemType, #[error("IFF PDU - Undetermined System Time.")]
23 IffUndeterminedSystemType, }