diff options
Diffstat (limited to 'src/error.rs')
| -rw-r--r-- | src/error.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/error.rs b/src/error.rs index 1ce9482..1b71511 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,5 @@ use homedir::GetHomeError; +use network_interface::Error as NetworkInterfaceError; use reqwest::{Error as ReqwestError, Url}; use serde_json::Error as JsonError; use std::fmt; @@ -16,6 +17,7 @@ pub enum AppError { InvalidResponse { url: Url, reason: String }, InvalidHttpHeader(String), UnableToGetHomeDirectory(GetHomeError), + NetworkInterfaceError(NetworkInterfaceError), } impl fmt::Display for AppError { @@ -34,11 +36,16 @@ impl fmt::Display for AppError { Self::RequestFailed { url, .. } => write!(f, "Request to {} failed", url), Self::InvalidResponse { url, reason } => { write!(f, "Invalid response from {}: {}", url, reason) - }, - Self::InvalidHttpHeader(message) => write!(f, "Invalid HTTP header configuration: {}", message), + } + Self::InvalidHttpHeader(message) => { + write!(f, "Invalid HTTP header configuration: {}", message) + } Self::UnableToGetHomeDirectory(err) => { write!(f, "Failed to get home directory: {}", err) } + Self::NetworkInterfaceError(err) => { + write!(f, "Network interface error: {}", err) + } } } } @@ -49,6 +56,7 @@ impl std::error::Error for AppError { Self::IoError(err) => Some(err), Self::ConfigParseError { source, .. } => Some(source), Self::RequestFailed { source, .. } => Some(source), + Self::NetworkInterfaceError(err) => Some(err), _ => None, } } |
