complete improvements in repos ktor parts

This commit is contained in:
2022-06-04 00:22:36 +06:00
parent eaa143f7d7
commit 78903cd4eb
30 changed files with 805 additions and 38 deletions

View File

@@ -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())
}