1use std::error::Error;
2use std::fmt;
3#[derive(Debug)]
5pub enum NetzworkApiError {
6 HostIdentityError(String),
7 UnknownNetInterfaceId(String),
8 SomeProblem(String),
9}
10
11impl Error for NetzworkApiError {}
13
14impl fmt::Display for NetzworkApiError {
16 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17 match self {
18 NetzworkApiError::HostIdentityError(msg) => {
19 write!(f, "Could not generate host UUID ({})", msg)
20 }
21 NetzworkApiError::UnknownNetInterfaceId(msg) => {
22 write!(f, "Could not identify Network Interface ({})", msg)
23 }
24 NetzworkApiError::SomeProblem(msg) => {
25 write!(f, "Something went wrong: {}", msg)
26 }
27 }
28 }
29}