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)