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
#[derive(Debug)]
pub enum Error {
ApiKeyNotSet,
HostnameNotSet,
MessageIDNotSet,
HttpError(reqwest::Error),
InvalidHeader(String),
ToNotSet,
ContentNotSet,
TooManyMessages,
NoMessageStatus,
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
write!(f, "{:?}", self)
}
}
impl From<reqwest::Error> for Error {
fn from(error: reqwest::Error) -> Self {
Error::HttpError(error)
}
}
impl From<reqwest::header::InvalidHeaderValue> for Error {
fn from(invalid_header: reqwest::header::InvalidHeaderValue) -> Self {
Error::InvalidHeader(format!("{invalid_header}"))
}
}