1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5 #[error("http request failed / {0}")]
6 Http(#[from] reqwest::Error),
7
8 #[error("json parsing failed / {0}")]
9 Json(#[from] serde_json::Error),
10
11 #[error("authentication required")]
12 AuthRequired,
13
14 #[error("invalid credentials")]
15 InvalidCredentials,
16
17 #[error("rate limited")]
18 RateLimited(Option<u64>),
19
20 #[error("user not found / {0}")]
21 UserNotFound(String),
22
23 #[error("media not found / {0}")]
24 MediaNotFound(String),
25
26 #[error("session expired")]
27 SessionExpired,
28
29 #[error("blocked by instagram")]
30 Blocked,
31
32 #[error("{0}")]
33 Api(String),
34}
35
36pub type Result<T> = std::result::Result<T, Error>;