diff --git a/src/errors.rs b/src/errors.rs index f097c811..b0dfd1fb 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -36,19 +36,19 @@ pub enum RequestError { InvalidJson(#[source] serde_json::Error), } -/// A kind of an API error returned from Telegram. If you receive Unknown value, +/// A kind of a API error returned from Telegram. If you receive Unknown value, /// please [open the issue](https://github.com/teloxide/teloxide/issues/new) with description /// of error. #[derive(Debug, Deserialize, PartialEq, Hash, Eq, Clone)] #[serde(untagged)] pub enum ApiErrorKind { - Known(ApiErrorKindKnown), + Known(KnownApiErrorKind), Unknown(String), } -/// A kind of an known API error returned from Telegram. +/// A kind of a known API error returned from Telegram. #[derive(Debug, Deserialize, PartialEq, Copy, Hash, Eq, Clone)] -pub enum ApiErrorKindKnown { +pub enum KnownApiErrorKind { /// Occurs when the bot tries to send message to user who blocked the bot. #[serde(rename = "Forbidden: bot was blocked by the user")] BotBlocked, diff --git a/src/net/telegram_response.rs b/src/net/telegram_response.rs index 3d30a17c..4be974eb 100644 --- a/src/net/telegram_response.rs +++ b/src/net/telegram_response.rs @@ -62,12 +62,12 @@ impl Into> for TelegramResponse { #[cfg(test)] mod tests { use super::*; - use crate::{errors::ApiErrorKindKnown, types::Update}; + use crate::{errors::KnownApiErrorKind, types::Update}; #[test] fn terminated_by_other_get_updates() { let expected = - ApiErrorKind::Known(ApiErrorKindKnown::TerminatedByOtherGetUpdates); + ApiErrorKind::Known(KnownApiErrorKind::TerminatedByOtherGetUpdates); if let TelegramResponse::Err{ kind, .. } = serde_json::from_str::>(r#"{"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}"#).unwrap() { assert_eq!(expected, kind); }