bugfix: catch users using something other than selfoss.

This commit is contained in:
Amine Bouabdallaoui 2024-12-30 13:51:45 +01:00
parent 162a350a8f
commit 1d99eeb633

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