mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
0.20.2 - MessageIsNotModifierException
This commit is contained in:
parent
fdf45d7566
commit
5249fb517f
@ -22,6 +22,10 @@
|
|||||||
* A lot of `TextSource` implementors was added. More info [here](src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/)
|
* A lot of `TextSource` implementors was added. More info [here](src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/)
|
||||||
* All `MessageEntity` implementations now are using new `TextSource` analogues as delegates
|
* All `MessageEntity` implementations now are using new `TextSource` analogues as delegates
|
||||||
|
|
||||||
|
### 0.20.2
|
||||||
|
|
||||||
|
* New exception type `MessageIsNotModifierException` was added
|
||||||
|
|
||||||
## 0.19.0 ImplicitReflection removing
|
## 0.19.0 ImplicitReflection removing
|
||||||
|
|
||||||
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
|
* Total rework of serialization for requests. Now all `SimpleRequest` children have:
|
||||||
|
@ -17,7 +17,7 @@ plugins {
|
|||||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
project.version = "0.20.1"
|
project.version = "0.20.2"
|
||||||
project.group = "com.github.insanusmokrassar"
|
project.group = "com.github.insanusmokrassar"
|
||||||
|
|
||||||
apply from: "publish.gradle"
|
apply from: "publish.gradle"
|
||||||
|
@ -8,11 +8,14 @@ fun newRequestException(
|
|||||||
plainAnswer: String,
|
plainAnswer: String,
|
||||||
message: String? = null,
|
message: String? = null,
|
||||||
cause: Throwable? = null
|
cause: Throwable? = null
|
||||||
) = when (response.description) {
|
) = response.description ?.let { description ->
|
||||||
"Bad Request: reply message not found" -> ReplyMessageNotFoundException(response, plainAnswer, message, cause)
|
when {
|
||||||
"Unauthorized" -> UnauthorizedException(response, plainAnswer, message, cause)
|
description == "Bad Request: reply message not found" -> ReplyMessageNotFoundException(response, plainAnswer, message, cause)
|
||||||
else -> CommonRequestException(response, plainAnswer, message, cause)
|
description.contains("Bad Request: message is not modified") -> MessageIsNotModifierException(response, plainAnswer, message, cause)
|
||||||
}
|
description == "Unauthorized" -> UnauthorizedException(response, plainAnswer, message, cause)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
} ?: CommonRequestException(response, plainAnswer, message, cause)
|
||||||
|
|
||||||
sealed class RequestException constructor(
|
sealed class RequestException constructor(
|
||||||
val response: Response,
|
val response: Response,
|
||||||
@ -32,3 +35,6 @@ class UnauthorizedException(response: Response, plainAnswer: String, message: St
|
|||||||
|
|
||||||
class ReplyMessageNotFoundException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
class ReplyMessageNotFoundException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||||
RequestException(response, plainAnswer, message, cause)
|
RequestException(response, plainAnswer, message, cause)
|
||||||
|
|
||||||
|
class MessageIsNotModifierException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||||
|
RequestException(response, plainAnswer, message, cause)
|
||||||
|
Loading…
Reference in New Issue
Block a user