wireguard_uapi/linux/err/
get_device_error.rs

1use super::ParseDeviceError;
2use neli::err::{NlError, SerError};
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum GetDeviceError {
7    #[error(transparent)]
8    NlError(NlError),
9
10    #[error(transparent)]
11    NlSerError(SerError),
12
13    #[error("Interface names must be 1 to IFNAMSIZ-1 characters")]
14    InvalidInterfaceName,
15
16    #[error(
17        "Unable to get interface from WireGuard. Make sure it exists and you have permissions to access it."
18    )]
19    AccessError,
20
21    #[error(transparent)]
22    ParseDeviceError(ParseDeviceError),
23}
24
25impl From<NlError> for GetDeviceError {
26    fn from(error: NlError) -> Self {
27        GetDeviceError::NlError(error)
28    }
29}
30
31impl From<SerError> for GetDeviceError {
32    fn from(error: SerError) -> Self {
33        GetDeviceError::NlSerError(error)
34    }
35}
36
37impl From<ParseDeviceError> for GetDeviceError {
38    fn from(error: ParseDeviceError) -> Self {
39        GetDeviceError::ParseDeviceError(error)
40    }
41}