From 3f896c22404fdbd310acbb479286e02697052293 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 22 Apr 2020 13:05:57 +0600 Subject: [PATCH] fix not implemented error thrown --- CHANGELOG.md | 4 ++++ .../TelegramBotAPI/types/update/RawUpdate.kt | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0babb1e0ed..ba88d7b936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,10 @@ ### 0.26.4 +* `TelegramBotAPI`: + * Now any getting of updates will return `UnknownUpdateType` when inside of deserialization will be + `SerializationException` or `NotImplemented` error + ### 0.26.3 * `TelegramBotAPI`: diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt index f96d60bdb2..e27b840986 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt @@ -64,12 +64,16 @@ internal data class RawUpdate constructor( raw ) } - } catch (e: SerializationException) { - UnknownUpdateType( - updateId, - raw.toString(), - raw - ) + } catch (e: Error) { + when (e) { + is SerializationException, + is NotImplementedError -> UnknownUpdateType( + updateId, + raw.toString(), + raw + ) + else -> throw e + } }.also { initedUpdate = it }