mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-02 22:59:48 +00:00
update handleSafely
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user