mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use reqwest::StatusCode;
|
|
|
|
//<editor-fold desc="download">
|
|
#[derive(Debug, Error, From)]
|
|
pub enum DownloadError {
|
|
#[error("A network error: {0}")]
|
|
NetworkError(#[source] reqwest::Error),
|
|
|
|
#[error("An I/O error: {0}")]
|
|
Io(#[source] std::io::Error),
|
|
}
|
|
|
|
//</editor-fold>
|
|
|
|
//<editor-fold desc="request">
|
|
#[derive(Debug, Error)]
|
|
pub enum RequestError {
|
|
#[error("A Telegram's error #{status_code}: {description}")]
|
|
ApiError {
|
|
status_code: StatusCode,
|
|
description: String,
|
|
},
|
|
|
|
/// The group has been migrated to a supergroup with the specified
|
|
/// identifier.
|
|
#[error("The group has been migrated to a supergroup with ID #{0}")]
|
|
MigrateToChatId(i64),
|
|
|
|
/// In case of exceeding flood control, the number of seconds left to wait
|
|
/// before the request can be repeated
|
|
#[error("Retry after {0} seconds")]
|
|
RetryAfter(i32),
|
|
|
|
#[error("A network error: {0}")]
|
|
NetworkError(#[source] reqwest::Error),
|
|
|
|
#[error("An error while parsing JSON: {0}")]
|
|
InvalidJson(#[source] serde_json::Error),
|
|
}
|
|
|
|
//</editor-fold>
|