1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(Debug, Error)]
8pub enum Error {
9 #[error("Network error: {0}")]
10 Network(#[from] reqwest::Error),
11
12 #[error("Serialization error: {0}")]
13 Serialization(#[from] serde_json::Error),
14
15 #[error("Telegram API error: {description} (error_code: {error_code:?})")]
16 Api {
17 error_code: Option<i32>,
18 description: String,
19 },
20
21 #[error("Invalid configuration: {0}")]
22 InvalidConfig(String),
23
24 #[error("Other error: {0}")]
25 Other(String),
26}
27