1use error_chain_mini::ChainedError;
2use error_chain_mini::ErrorKind;
3
4use crate::api::RespParas;
5
6#[derive(ErrorKind)]
7pub enum TGBotErrorKind {
8 #[msg(short = "Client error", detailed = "inner: {:?}", _0)]
9 ClientError(reqwest::Error),
10 #[msg(short = "Request error", detailed = "inner: {:?}", _0)]
11 RequestError(reqwest::Error),
12 #[msg(short = "Request error", detailed = "inner: {:?}", _0)]
13 ProxyError(reqwest::Error),
14 #[msg(short = "Json error", detailed = "inner: {:?}", _0)]
15 JsonError(::serde_json::Error),
16 #[msg(short = "Call telegram error", detailed = "inner: {:?} => {:?}", _0, _1)]
17 TGError(String, Option<RespParas>),
18EmptyBody,
20 LoseToken,
21 ComingSoon,
22 Other,
23}
24
25pub type TGBotError = ChainedError<TGBotErrorKind>;
26pub type TGBotResult<T> = Result<T, TGBotError>;
27
28