1use std::fmt;
4
5use url::ParseError;
6
7#[derive(Debug)]
9pub enum Error {
10 Url(ParseError),
12 Reqwest(reqwest::Error),
14 UserNotFound,
16}
17
18impl std::error::Error for Error {}
19
20impl fmt::Display for Error {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 match self {
23 Self::Url(e) => write!(f, "{e}"),
24 Self::Reqwest(e) => write!(f, "{e}"),
25 Self::UserNotFound => write!(f, "User not found"),
26 }
27 }
28}
29
30impl From<ParseError> for Error {
31 fn from(e: ParseError) -> Self {
32 Self::Url(e)
33 }
34}
35
36impl From<reqwest::Error> for Error {
37 fn from(e: reqwest::Error) -> Self {
38 Self::Reqwest(e)
39 }
40}