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