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> { suspend inline fun <reified T> bodyOrFailure(r: HttpResponse?): StatusAndData<T> {
return if (r != null && r.status.isSuccess()) { try {
StatusAndData.succes(r.body()) return if (r != null && r.status.isSuccess()) {
} else { StatusAndData.succes(r.body())
StatusAndData.error() } else {
StatusAndData.error()
}
} catch (e: Throwable) {
return StatusAndData.error()
} }
} }