wireguard_uapi/linux/err/
list_devices_error.rs

1use super::ParseAttributeError;
2use neli::err::{DeError, NlError, SerError};
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum ListDevicesError {
7    #[error(transparent)]
8    NlError(NlError),
9
10    #[error(transparent)]
11    NlDeError(DeError),
12
13    #[error(transparent)]
14    NlSerError(SerError),
15
16    #[error(transparent)]
17    ParseAttributeError(ParseAttributeError),
18
19    // TODO: Print netlink error message when neli exposes it.
20    #[error("Unknown netlink error while reading devices.")]
21    Unknown,
22}
23
24impl From<NlError> for ListDevicesError {
25    fn from(error: NlError) -> Self {
26        Self::NlError(error)
27    }
28}
29
30impl From<DeError> for ListDevicesError {
31    fn from(error: DeError) -> Self {
32        Self::NlDeError(error)
33    }
34}
35
36impl From<SerError> for ListDevicesError {
37    fn from(error: SerError) -> Self {
38        Self::NlSerError(error)
39    }
40}
41
42impl From<ParseAttributeError> for ListDevicesError {
43    fn from(error: ParseAttributeError) -> Self {
44        Self::ParseAttributeError(error)
45    }
46}