mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
update handleSafely
This commit is contained in:
parent
c0d4a4f01b
commit
dc0fda2066
@ -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
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user