From a68c31f9d1a4283890a250188546f471c55bd172 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 13 Dec 2019 23:55:06 +0600 Subject: [PATCH] 0.20.2 - MessageToEditNotFoundException --- CHANGELOG.md | 1 + .../TelegramBotAPI/bot/exceptions/RequestException.kt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b131151a37..dc5906bc30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ ### 0.20.2 * New exception type `MessageIsNotModifierException` was added +* New exception type `MessageToEditNotFoundException` was added * Now exceptions in requests will be caught correctly ## 0.19.0 ImplicitReflection removing diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt index eb8a0e6659..e44d24356e 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt @@ -11,6 +11,7 @@ fun newRequestException( ) = response.description ?.let { description -> when { description == "Bad Request: reply message not found" -> ReplyMessageNotFoundException(response, plainAnswer, message, cause) + description == "Bad Request: message to edit not found" -> MessageToEditNotFoundException(response, plainAnswer, message, cause) description.contains("Bad Request: message is not modified") -> MessageIsNotModifiedException(response, plainAnswer, message, cause) description == "Unauthorized" -> UnauthorizedException(response, plainAnswer, message, cause) else -> null @@ -38,3 +39,6 @@ class ReplyMessageNotFoundException(response: Response, plainAnswer: String, mes class MessageIsNotModifiedException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) : RequestException(response, plainAnswer, message, cause) + +class MessageToEditNotFoundException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) : + RequestException(response, plainAnswer, message, cause)