Bugfixes #171

Merged
AmineB merged 12 commits from bugfixes into master 2024-12-30 22:32:12 +00:00
Showing only changes of commit 1d99eeb633 - Show all commits

View File

@ -30,10 +30,14 @@ suspend fun maybeResponse(r: HttpResponse?): SuccessResponse {
}
suspend inline fun <reified T> bodyOrFailure(r: HttpResponse?): StatusAndData<T> {
return if (r != null && r.status.isSuccess()) {
StatusAndData.succes(r.body())
} else {
StatusAndData.error()
try {
return if (r != null && r.status.isSuccess()) {
StatusAndData.succes(r.body())
} else {
StatusAndData.error()
}
} catch (e: Throwable) {
return StatusAndData.error()
}
}
@ -94,4 +98,4 @@ suspend fun HttpClient.tryToSubmitForm(
url(url)
block()
}
}
}