mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-02 22:59:48 +00:00
fixes
This commit is contained in:
@@ -3,6 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.supervisorScope
|
||||
|
||||
|
||||
typealias ExceptionHandler<T> = suspend (Exception) -> T
|
||||
/**
|
||||
* It will run [block] inside of [supervisorScope] to avoid problems with catching of exceptions
|
||||
*
|
||||
@@ -10,7 +12,7 @@ import kotlinx.coroutines.supervisorScope
|
||||
* exception will be available for catching
|
||||
*/
|
||||
suspend inline fun <T> handleSafely(
|
||||
noinline onException: suspend (Exception) -> T = { throw it },
|
||||
noinline onException: ExceptionHandler<T> = { throw it },
|
||||
noinline block: suspend CoroutineScope.() -> T
|
||||
): T {
|
||||
return try {
|
||||
|
@@ -41,7 +41,7 @@ suspend fun RequestsExecutor.setWebhook(
|
||||
scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),
|
||||
allowedUpdates: List<String>? = null,
|
||||
maxAllowedConnections: Int? = null,
|
||||
exceptionsHandler: (suspend (Exception) -> Unit)? = null,
|
||||
exceptionsHandler: (ExceptionHandler<Unit>)? = null,
|
||||
block: UpdateReceiver<Update>
|
||||
): Job {
|
||||
val executeDeferred = certificate ?.let {
|
||||
|
Reference in New Issue
Block a user