isotp_rs/
error.rs

1#[derive(Debug, Clone, thiserror::Error)]
2pub enum Error {
3    #[error("ISO-TP - device error")]
4    DeviceError,
5
6    #[error("ISO-TP - the pdu(protocol data unit) is empty")]
7    EmptyPdu,
8
9    #[error("ISO-TP - invalid pdu(protocol data unit): {0:?}")]
10    InvalidPdu(Vec<u8>),
11
12    #[error("ISO-TP - invalid parameter: {0}")]
13    InvalidParam(String),
14
15    #[error("ISO-TP - invalid data length: {actual}, expect: {expect}")]
16    InvalidDataLength { actual: usize, expect: usize, },
17
18    #[error("ISO-TP - data length: {0} is out of range")]
19    LengthOutOfRange(usize),
20
21    #[error("ISO-TP - invalid st_min: {0:02X}")]
22    InvalidStMin(u8),
23
24    #[error("ISO-TP - invalid sequence: {actual}, expect: {expect}")]
25    InvalidSequence{ actual: u8, expect: u8, },
26
27    #[error("ISO-TP - mixed frames")]
28    MixFramesError,
29
30    #[error("ISO-TP - timeout when time({value}{unit})")]
31    Timeout { value: u64, unit: &'static str },
32
33    #[error("ISO-TP - error when converting {src:?} to {target:?}")]
34    ConvertError { src: &'static str, target: &'static str, },
35
36    #[error("ISO-TP - ECU has overload flow control response")]
37    OverloadFlow,
38
39    #[error("ISO-TP - context error when {0}")]
40    ContextError(String),
41}