simple_someip/protocol/error.rs
1use thiserror::Error;
2
3/// Errors that can occur when encoding, decoding, or validating SOME/IP messages.
4#[derive(Error, Debug)]
5pub enum Error {
6 /// An I/O error occurred while reading or writing bytes.
7 #[error("I/O error: {0:?}")]
8 Io(embedded_io::ErrorKind),
9 /// The input buffer ended before the expected number of bytes could be read.
10 #[error("Unexpected end of input")]
11 UnexpectedEof,
12 /// The protocol version field contains an unsupported value.
13 #[error("Invalid protocol version: {0:X}")]
14 InvalidProtocolVersion(u8),
15 /// The message type field contains an unrecognized value.
16 #[error("Invalid value in MessageType field: {0:X}")]
17 InvalidMessageTypeField(u8),
18 /// The return code field contains an unrecognized value.
19 #[error("Invalid value in ReturnCode field: {0:X}")]
20 InvalidReturnCode(u8),
21 /// The message ID is not supported by the payload implementation.
22 #[error("Unsupported MessageID {0:X?}")]
23 UnsupportedMessageID(super::MessageId),
24 /// A service discovery (SD) error occurred.
25 #[error(transparent)]
26 Sd(#[from] super::sd::Error),
27}