iso15765_2/
error.rs

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