1use std::error;
2
3use bincode::ErrorKind;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
7pub enum NetlinkError {
8 #[error("Failed to create socket: {0}")]
9 Socket(#[from] Box<dyn error::Error>),
10
11 #[error("Failed to send message: {0}")]
12 Send(String),
13
14 #[error("Netlink error: {0}")]
15 Netlink(String),
16
17 #[error("Failed to decode netlink message: {0}")]
18 NetlinkDecode(String),
19}
20
21#[derive(Debug, Error)]
22pub enum LinkError {
23 #[error("rust-netlink error: {0}")]
24 Netlink(#[from] NetlinkError),
25
26 #[error("Missing attribute: {0}")]
27 MissingAttribute(String),
28}
29
30#[derive(Debug, Error)]
31pub enum TcError {
32 #[error("rust-netlink error: {0}")]
33 Netlink(#[from] NetlinkError),
34
35 #[error("Failed to retrieve links: {0}")]
36 Link(#[from] LinkError),
37
38 #[error("Failed to decode field: {0}")]
39 Decode(String),
40
41 #[error("Failed to unmarshal struct: {0}")]
42 UnmarshalStruct(#[from] Box<ErrorKind>),
43
44 #[error("Failed to unmarshal structs: {0}")]
45 UnmarshalStructs(String),
46
47 #[error("Inavalid attribute: {0}")]
48 InvalidAttribute(String),
49
50 #[error("Attribute not implemented: {0}")]
51 UnimplementedAttribute(String),
52}