mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
safely function
This commit is contained in:
parent
9ae252717d
commit
2a276d9272
@ -56,6 +56,8 @@
|
|||||||
* `Klock`: `1.11.1` -> `1.11.3`
|
* `Klock`: `1.11.1` -> `1.11.3`
|
||||||
* `TelegramotAPI`:
|
* `TelegramotAPI`:
|
||||||
* Fix: for sending requests caption and text lengths limits were updated
|
* Fix: for sending requests caption and text lengths limits were updated
|
||||||
|
* `TelegramBotAPI-extensions-utils`:
|
||||||
|
* `safely` function was introduced. It is in `PreviewFeature` state currently
|
||||||
|
|
||||||
### 0.27.4
|
### 0.27.4
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortcut for [handleSafely]. It was created for more comfortable way of handling different things
|
||||||
|
*/
|
||||||
|
@PreviewFeature
|
||||||
|
suspend inline fun <T> safely(
|
||||||
|
noinline onException: ExceptionHandler<T> = { throw it },
|
||||||
|
noinline block: suspend CoroutineScope.() -> T
|
||||||
|
): T = handleSafely(
|
||||||
|
onException,
|
||||||
|
block
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user