From 694ae1ee8547baea2909e5a0fb4389108a014a4c Mon Sep 17 00:00:00 2001 From: stillbeingnick Date: Fri, 28 Jul 2023 12:25:55 -0700 Subject: [PATCH] adding enum variant to handle unknown 400 --- crates/teloxide-core/src/errors.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/teloxide-core/src/errors.rs b/crates/teloxide-core/src/errors.rs index 95c1e765..cdb9754e 100644 --- a/crates/teloxide-core/src/errors.rs +++ b/crates/teloxide-core/src/errors.rs @@ -238,6 +238,16 @@ impl_api_error! { /// [`DeleteMessage`]: crate::payloads::DeleteMessage MessageCantBeDeleted = "Bad Request: message can't be deleted", + /// Occurs when a bot tries to delete a message created by the bot + /// in a group they belong to but have no rights to delete the message + /// for all in the group. + /// + /// May happen in methods: + /// 1. [`DeleteMessage`] + /// + /// [`DeleteMessage`]: crate::payloads::DeleteMessage + MessageCantBeDeletedForEveryone = "Bad Request: message can't be deleted for everyone", + /// Occurs when bot tries to edit a message which does not exists. /// /// May happen in methods: @@ -828,6 +838,10 @@ mod tests { "{\"data\": \"Bad Request: message can't be deleted\"}", ApiError::MessageCantBeDeleted, ), + ( + "{\"data\": \"Bad Request: message can't be deleted for everyone\"}", + ApiError::MessageCantBeDeletedForEveryone, + ), ( "{\"data\": \"Bad Request: message to edit not found\"}", ApiError::MessageToEditNotFound, @@ -868,6 +882,7 @@ mod tests { ApiError::PollQuestionMustBeNonEmpty, ), ( + "{\"data\": \"Bad Request: poll options length must not exceed 100\"}", ApiError::PollOptionsLengthTooLong, ),