adding enum variant to handle unknown 400

This commit is contained in:
stillbeingnick 2023-07-28 12:25:55 -07:00
parent 10846e19fd
commit 694ae1ee85

View file

@ -238,6 +238,16 @@ impl_api_error! {
/// [`DeleteMessage`]: crate::payloads::DeleteMessage /// [`DeleteMessage`]: crate::payloads::DeleteMessage
MessageCantBeDeleted = "Bad Request: message can't be deleted", 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. /// Occurs when bot tries to edit a message which does not exists.
/// ///
/// May happen in methods: /// May happen in methods:
@ -828,6 +838,10 @@ mod tests {
"{\"data\": \"Bad Request: message can't be deleted\"}", "{\"data\": \"Bad Request: message can't be deleted\"}",
ApiError::MessageCantBeDeleted, ApiError::MessageCantBeDeleted,
), ),
(
"{\"data\": \"Bad Request: message can't be deleted for everyone\"}",
ApiError::MessageCantBeDeletedForEveryone,
),
( (
"{\"data\": \"Bad Request: message to edit not found\"}", "{\"data\": \"Bad Request: message to edit not found\"}",
ApiError::MessageToEditNotFound, ApiError::MessageToEditNotFound,
@ -868,6 +882,7 @@ mod tests {
ApiError::PollQuestionMustBeNonEmpty, ApiError::PollQuestionMustBeNonEmpty,
), ),
( (
"{\"data\": \"Bad Request: poll options length must not exceed 100\"}", "{\"data\": \"Bad Request: poll options length must not exceed 100\"}",
ApiError::PollOptionsLengthTooLong, ApiError::PollOptionsLengthTooLong,
), ),