mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-06-23 03:35:07 +00:00
Compare commits
1 Commits
28.0.2
...
31d891d756
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31d891d756 |
@@ -1,11 +1,5 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
## 28.0.2
|
|
||||||
|
|
||||||
* `Core`:
|
|
||||||
* [#1001](https://github.com/InsanusMokrassar/ktgbotapi/issues/1001) - `[Bug] Invalid detection of isCausedByCancellation()`
|
|
||||||
* [#1002](https://github.com/InsanusMokrassar/ktgbotapi/issues/1002) - `Unable to handle UnauthorizedException with buildBehaviourWithLongPolling`
|
|
||||||
|
|
||||||
## 28.0.1
|
## 28.0.1
|
||||||
|
|
||||||
* `Version`:
|
* `Version`:
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ kotlin.incremental.js=true
|
|||||||
ksp.useKSP2=false
|
ksp.useKSP2=false
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=28.0.2
|
library_version=28.0.1
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ktor = "3.2.3"
|
|||||||
ksp = "2.2.10-2.0.2"
|
ksp = "2.2.10-2.0.2"
|
||||||
kotlin-poet = "2.2.0"
|
kotlin-poet = "2.2.0"
|
||||||
|
|
||||||
microutils = "0.26.3"
|
microutils = "0.26.4"
|
||||||
kslog = "1.5.0"
|
kslog = "1.5.0"
|
||||||
|
|
||||||
versions = "0.52.0"
|
versions = "0.52.0"
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ suspend fun TelegramBot.buildBehaviourWithLongPolling(
|
|||||||
timeoutSeconds = timeoutSeconds,
|
timeoutSeconds = timeoutSeconds,
|
||||||
autoDisableWebhooks = autoDisableWebhooks,
|
autoDisableWebhooks = autoDisableWebhooks,
|
||||||
autoSkipTimeoutExceptions = autoSkipTimeoutExceptions,
|
autoSkipTimeoutExceptions = autoSkipTimeoutExceptions,
|
||||||
mediaGroupsDebounceTimeMillis = mediaGroupsDebounceTimeMillis,
|
mediaGroupsDebounceTimeMillis = mediaGroupsDebounceTimeMillis
|
||||||
exceptionsHandler = defaultExceptionsHandler
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class DefaultKtorRequestsExecutor internal constructor(
|
|||||||
|
|
||||||
when (e) {
|
when (e) {
|
||||||
is ClientRequestException -> {
|
is ClientRequestException -> {
|
||||||
val exceptionResult = runCatchingLogging(logger = Log) {
|
val exceptionResult = runCatching {
|
||||||
val content = e.response.bodyAsText()
|
val content = e.response.bodyAsText()
|
||||||
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
|
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
|
||||||
newRequestException(
|
newRequestException(
|
||||||
|
|||||||
@@ -2,17 +2,6 @@ package dev.inmo.tgbotapi.utils
|
|||||||
|
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
|
|
||||||
/**
|
|
||||||
* Traverses this throwable's cause chain to find a [CancellationException].
|
|
||||||
*
|
|
||||||
* It walks through `this` and its `cause`s until the first [CancellationException] is encountered,
|
|
||||||
* and returns that exception. If no [CancellationException] is found in the chain, returns `null`.
|
|
||||||
*
|
|
||||||
* This is useful when you need to distinguish cancellations from other failures while handling errors.
|
|
||||||
*
|
|
||||||
* @receiver the root [Throwable] to inspect
|
|
||||||
* @return the first [CancellationException] found in the cause chain, or `null` if none present
|
|
||||||
*/
|
|
||||||
fun Throwable.causedCancellationException(): CancellationException? {
|
fun Throwable.causedCancellationException(): CancellationException? {
|
||||||
var current = this
|
var current = this
|
||||||
while (current !is CancellationException) {
|
while (current !is CancellationException) {
|
||||||
@@ -26,10 +15,4 @@ fun Throwable.causedCancellationException(): CancellationException? {
|
|||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
fun Throwable.isCausedByCancellation(): Boolean = causedCancellationException() == null
|
||||||
* Checks whether this throwable (or any of its causes) is a [CancellationException].
|
|
||||||
*
|
|
||||||
* @receiver the [Throwable] to inspect
|
|
||||||
* @return `true` if a [CancellationException] is found in the cause chain, `false` otherwise
|
|
||||||
*/
|
|
||||||
fun Throwable.isCausedByCancellation(): Boolean = causedCancellationException() != null
|
|
||||||
|
|||||||
Reference in New Issue
Block a user