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> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user