1use std::fmt;
2use std::error::Error as StdError;
3
4pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(Debug)]
7pub enum Error {
8 Reqwest(reqwest::Error),
9 Pixiv(String),
10}
11
12impl fmt::Display for Error {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 match self {
15 Error::Reqwest(e) => {e.fmt(f)}
16 Error::Pixiv(s) => {write!(f, "Pixiv error: {}", s)}
17 }
18 }
19}
20
21impl StdError for Error {}
22
23impl From<reqwest::Error> for Error {
24 fn from(e: reqwest::Error) -> Self {
25 Self::Reqwest(e)
26 }
27}