local_ip_address/
error.rs1use std::fmt;
2
3#[derive(Debug, PartialEq)]
4pub enum Error {
5 LocalIpAddressNotFound,
8 StrategyError(String),
11 PlatformNotSupported(String),
13}
14
15impl fmt::Display for Error {
16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17 match self {
18 Error::LocalIpAddressNotFound => write!(
19 f,
20 "The Local IP Address wasn't available in the network interfaces list/table"
21 ),
22 Error::StrategyError(msg) => write!(
23 f,
24 "An error occurred executing the underlying strategy error.\n{}",
25 msg
26 ),
27 Error::PlatformNotSupported(platform) => {
28 write!(f, "The current platform: `{}`, is not supported", platform)
29 }
30 }
31 }
32}
33
34impl std::error::Error for Error {}