mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-10-31 17:12:58 +00:00
complete improvements in repos ktor parts
This commit is contained in:
1 parent
eaa143f7d7
commit
78903cd4eb
30 files changed
+805
-38
No files matched your search
+15
@@ -0,0 +1,15 @@
|
||||
package dev.inmo.micro_utils.ktor.client
|
||||
|
||||
import io.ktor.client.plugins.ClientRequestException
|
||||
import io.ktor.client.statement.HttpResponse
|
||||
import io.ktor.http.isSuccess
|
||||
|
||||
inline fun HttpResponse.throwOnUnsuccess(
|
||||
unsuccessMessage: () -> String
|
||||
) {
|
||||
if (status.isSuccess()) {
|
||||
return
|
||||
}
|
||||
|
||||
throw ClientRequestException(this, unsuccessMessage())
|
||||
}
|
||||
Reference in new issue
Block a user