mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
fixed typos
This commit is contained in:
parent
0ba4db26e5
commit
3fa827ab0a
2 changed files with 6 additions and 6 deletions
|
@ -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,
|
||||
|
|
|
@ -62,12 +62,12 @@ impl<R> Into<ResponseResult<R>> for TelegramResponse<R> {
|
|||
#[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::<TelegramResponse<Update>>(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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue