1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 03:28:44 +00:00

Merge pull request #132 from InsanusMokrassar/0.28.1

0.28.1
This commit is contained in:
InsanusMokrassar 2020-09-12 22:38:24 +06:00 committed by GitHub
commit 3f13e5d062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 8 deletions

View File

@ -42,6 +42,17 @@
* `HttpClient#loadFile` * `HttpClient#loadFile`
* `PathedFile#download` * `PathedFile#download`
### 0.28.1
* Common:
* 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`
* `handleSafely` has changed its signature
* `executeUnsafe` has changed its signature
## 0.27.0 ## 0.27.0
* `Common`: * `Common`:

View File

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

View File

@ -24,10 +24,10 @@ suspend fun <T: Any> RequestsExecutor.executeUnsafe(
request: Request<T>, request: Request<T>,
retries: Int = 0, retries: Int = 0,
retriesDelay: Long = 1000L, retriesDelay: Long = 1000L,
onAllFailed: (suspend (exceptions: Array<Exception>) -> Unit)? = null onAllFailed: (suspend (exceptions: Array<Throwable>) -> Unit)? = null
): T? { ): T? {
var leftRetries = retries var leftRetries = retries
val exceptions = onAllFailed ?.let { mutableListOf<Exception>() } val exceptions = onAllFailed ?.let { mutableListOf<Throwable>() }
do { do {
return handleSafely( return handleSafely(
{ {

View File

@ -5,16 +5,16 @@ kotlin.js.generate.externals=true
kotlin.incremental=true kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
kotlin_version=1.4.0 kotlin_version=1.4.10
kotlin_coroutines_version=1.3.9 kotlin_coroutines_version=1.3.9
kotlin_serialisation_runtime_version=1.0.0-RC kotlin_serialisation_runtime_version=1.0.0-RC
klock_version=1.12.0 klock_version=1.12.0
uuid_version=0.2.1 uuid_version=0.2.2
ktor_version=1.4.0 ktor_version=1.4.0
javax_activation_version=1.1.1 javax_activation_version=1.1.1
library_group=com.github.insanusmokrassar library_group=com.github.insanusmokrassar
library_version=0.28.0 library_version=0.28.1
gradle_bintray_plugin_version=1.8.5 gradle_bintray_plugin_version=1.8.5

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip