wireguard_uapi/linux/err/
link_device_error.rs

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