use thiserror::Error;
#[derive(Debug, Error)]
#[allow(dead_code)]
pub enum IwconfError {
#[error("this build only supports Windows (built native WLAN API bindings are Windows-only)")]
UnsupportedPlatform,
#[error("no wireless interfaces were found on this system")]
NoInterfaces,
#[error("no interface matches pattern '{0}'")]
NoInterfaceMatch(String),
#[error("pattern '{pattern}' matches {count} interfaces, please narrow it: {names}")]
AmbiguousInterface {
pattern: String,
count: usize,
names: String,
},
#[error("interface '{0}' is not connected to any network")]
NotConnected(String),
#[error("WLAN API call '{call}' failed with status {code} (0x{code:08X})")]
WlanApi { call: &'static str, code: u32 },
#[error("failed to open a handle to the WLAN service (is 'WLAN AutoConfig' running?)")]
ServiceUnavailable,
#[error("network '{0}' was not found in the scan results for this interface")]
NetworkNotFound(String),
#[error("a passphrase is required to connect to a secured network")]
MissingPassphrase,
#[error("connect attempt to '{0}' timed out")]
ConnectTimeout(String),
#[error("config error: {0}")]
Config(#[from] config_get::ConfigError),
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, IwconfError>;