bugfix: catch users using something other than selfoss.
This commit is contained in:
parent
162a350a8f
commit
1d99eeb633
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,4 +98,4 @@ suspend fun HttpClient.tryToSubmitForm(
|
|||||||
url(url)
|
url(url)
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user