1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 16:47:13 +00:00

update handleSafely

This commit is contained in:
InsanusMokrassar 2020-09-12 16:18:00 +06:00
parent c0d4a4f01b
commit dc0fda2066
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -4,7 +4,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.supervisorScope
typealias ExceptionHandler<T> = suspend (Exception) -> T
typealias ExceptionHandler<T> = suspend (Throwable) -> T
/**
* It will run [block] inside of [supervisorScope] to avoid problems with catching of exceptions
*
@ -17,7 +17,7 @@ suspend inline fun <T> handleSafely(
): T {
return try {
supervisorScope(block)
} catch (e: Exception) {
} catch (e: Throwable) {
onException(e)
}
}