diff --git a/CHANGELOG.md b/CHANGELOG.md index e297c1d8be..0b939bfef7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * `UpdatesFilter` now use new type of updates for mediagroups * Add `GetWebhookInfo` request and `WebhookInfo` type * Replace updates types into separated place in types +* Now default `RequestException` will contain plain answer from telegram ## 0.11.0 diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt index 15ae5c6537..285bf033e9 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt @@ -77,7 +77,8 @@ class KtorRequestsExecutor( } ?: call.let { throw newRequestException( responseObject, - "Can't get result object" + content, + "Can't get result object from $content" ) } } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/ReplyMessageNotFound.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/ReplyMessageNotFound.kt index 0208179047..ae66d2d920 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/ReplyMessageNotFound.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/ReplyMessageNotFound.kt @@ -2,5 +2,5 @@ package com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions import com.github.insanusmokrassar.TelegramBotAPI.types.Response -open class ReplyMessageNotFound(response: Response<*>, message: String?, cause: Throwable?) : - RequestException(response, message, cause) \ No newline at end of file +open class ReplyMessageNotFound(response: Response<*>, plainAnswer: String, message: String?, cause: Throwable?) : + RequestException(response, plainAnswer, message, cause) \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt index 1783631604..4f0d627927 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt @@ -5,15 +5,17 @@ import java.io.IOException fun newRequestException( response: Response<*>, + plainAnswer: String, message: String? = null, cause: Throwable? = null ) = when (response.description) { - "Bad Request: reply message not found" -> ReplyMessageNotFound(response, message, cause) - else -> RequestException(response, message, cause) + "Bad Request: reply message not found" -> ReplyMessageNotFound(response, plainAnswer, message, cause) + else -> RequestException(response, plainAnswer, message, cause) } open class RequestException internal constructor( val response: Response<*>, + val plainAnswer: String, message: String? = null, cause: Throwable? = null ) : IOException(