1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use thiserror::Error;
use mac_address::MacAddressError;
use std::convert::Infallible;
use std::num::ParseIntError;
#[derive(Error, Debug)]
pub enum Error {
#[error("Parse failure: {0}")]
ParseFailure(String),
#[error("couldn't parse integer")]
ParseIntError(#[from] ParseIntError),
#[error("missing required header {0}")]
MissingHeader(&'static str),
#[error("Required header {0} had incorrect value")]
IncorrectHeader(&'static str),
#[error("Header {0} had a value we couldn't parse ({1})")]
MalformedHeader(&'static str, String),
#[error("Field {0} had a value we couldn't parse ({1})")]
MalformedField(&'static str, String),
#[error("IO Error {0}")]
IO(#[from] std::io::Error),
#[error("Format Error")]
Fmt(#[from] std::fmt::Error),
#[error("Received a packet we don't understand")]
UnknownPacket,
#[error("Couldn't discover this computer's MAC address")]
MACAddressError(#[from] MacAddressError),
#[error("if you see this, something's wrong")]
Infallible(#[from] Infallible),
#[error("Failed to generate a UUID")]
UUID(#[from] uuid::Error),
#[error("Couldn't retrieve over http ({0})")]
HTTPError(#[from] reqwest::Error),
#[error("Couldn't parse an XML document: {0}")]
XMLError(#[from] serde_xml_rs::Error),
}