diff --git a/src/errors.rs b/src/errors.rs index e8c1ae21..4a629d71 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -39,3 +39,50 @@ pub enum RequestError { } // + +#[derive(Debug, Deserialize, PartialEq, Copy, Hash, Eq)] +enum ApiErrorKind { + /// Occurs when the bot has been blocked by the user. + #[serde(rename = "Forbidden: bot was blocked by the user")] + BotBlocked, + + /// Occurs when bot trying to modify a message without modification content + #[serde(rename = "Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message")] + MessageNotModified, + + /// Occurs when bot trying to forward or delete a message which was deleted + #[serde(rename = "Bad Request: MESSAGE_ID_INVALID")] + MessageIdInvalid, + + /// Occurs when bot trying to forward a message which does not exists + #[serde(rename = "Bad Request: message to forward not found")] + MessageToForwardNotFound, + + /// Occurs when bot trying to delete a message which does not exists + #[serde(rename = "Bad Request: message to delete not found")] + MessageToDeleteNotFound, + + /// Occurs when bot trying to send a text message without text + #[serde(rename = "Bad Request: message text is empty")] + MessageTextIsEmpty, + + MessageCantBeEdited, //? + + MessageCantBeDeleted, //? + + /// Occurs when bot trying to edit a message which does not exists + #[serde(rename = "Bad Request: message to edit not found")] + MessageToEditNotFound, + + /// Occurs when bot trying to reply to a message which does not exists + #[serde(rename = "Bad Request: reply message not found")] + MessageToReplyNotFound, + + ToMuchMessages, //? + + PollCantBeStopped, //? + + /// Occurs when bot trying to stop poll that has already been stopped + #[serde(rename = "Bad Request: poll has already been closed")] + PollHasAlreadyClosed, +}