Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Correct deserialization of NotFound and UserDeactivated errors
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Jun 2, 2022
1 parent 21c5819 commit b03d9d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add `ChatId` and `UserId` to the prelude ([#212][pr212])
- Add `is_*` methods to `ChatMemberStatus` analogous to the `ChatMember{,Kind}` methods ([#216][pr216])
- Correct how `NotFound` and `UserDeactivated` errors are deserialized ([#219][pr219])

[pr212]: https://github.com/teloxide/teloxide-core/pull/212
[pr216]: https://github.com/teloxide/teloxide-core/pull/216
[pr219]: https://github.com/teloxide/teloxide-core/pull/219

## 0.6.0 - 2022-04-25

Expand Down
11 changes: 6 additions & 5 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ pub enum ApiError {
BotBlocked,

/// Occurs when the bot token is incorrect.
#[serde(rename = "Forbidden: bot was blocked by the user")]
#[error("Forbidden: bot was blocked by the user")]
#[serde(rename = "Not Found")]
#[error("Not Found")]
NotFound,

/// Occurs when bot tries to modify a message without modification content.
Expand Down Expand Up @@ -684,14 +684,15 @@ pub enum ApiError {
#[error("Forbidden: bot was kicked from the supergroup chat")]
BotKickedFromSupergroup,

/// Occurs when bot tries to send message to deactivated user.
/// Occurs when bot tries to send a message to a deactivated user (i.e. a
/// user that was banned by telegram).
///
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Unauthorized: user is deactivated")]
#[error("Unauthorized: user is deactivated")]
#[serde(rename = "Forbidden: user is deactivated")]
#[error("Forbidden: user is deactivated")]
UserDeactivated,

/// Occurs when you tries to initiate conversation with a user.
Expand Down

0 comments on commit b03d9d8

Please sign in to comment.