From dc0fda20662db88f0f436baec57f6f04c4a2b808 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 12 Sep 2020 16:18:00 +0600 Subject: [PATCH] update handleSafely --- CHANGELOG.md | 2 ++ .../insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ed40c40cf..ae7534f3de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,8 @@ * Versions updates: * `Kotlin`: `1.4.0` -> `1.4.10` * `UUID`: `0.2.1` -> `0.2.2` +* `TelegramBotAPI-core`: + * `ExceptionHandler` has changed its incoming type: `Exception` -> `Throwable` ## 0.27.0 diff --git a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt index 955cfe7bb7..b136954b55 100644 --- a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt @@ -4,7 +4,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.supervisorScope -typealias ExceptionHandler = suspend (Exception) -> T +typealias ExceptionHandler = suspend (Throwable) -> T /** * It will run [block] inside of [supervisorScope] to avoid problems with catching of exceptions * @@ -17,7 +17,7 @@ suspend inline fun handleSafely( ): T { return try { supervisorScope(block) - } catch (e: Exception) { + } catch (e: Throwable) { onException(e) } }