clickatell_api/one_api/
error.rs1#[derive(Debug)]
2pub enum Error {
3 ApiKeyNotSet,
4 HostnameNotSet,
5 MessageIDNotSet,
6 HttpError(reqwest::Error),
7 InvalidHeader(String),
8 ToNotSet,
9 ContentNotSet,
10 TooManyMessages,
11 NoMessageStatus,
12}
13
14impl std::fmt::Display for Error {
15 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
16 write!(f, "{:?}", self)
17 }
18}
19
20impl From<reqwest::Error> for Error {
21 fn from(error: reqwest::Error) -> Self {
22 Error::HttpError(error)
23 }
24}
25
26impl From<reqwest::header::InvalidHeaderValue> for Error {
27 fn from(invalid_header: reqwest::header::InvalidHeaderValue) -> Self {
28 Error::InvalidHeader(format!("{invalid_header}"))
29 }
30}