fix: better error message

This commit is contained in:
rebelonion 2024-02-15 13:24:34 -06:00
parent b4c7ea5f26
commit 9d9c4f026d
2 changed files with 5 additions and 1 deletions

View file

@ -38,6 +38,10 @@ object CommentsAPI {
val request = requestBuilder()
val json = request.get(url)
if (!json.text.startsWith("{")) return null
val res = json.code == 200
if (!res) {
errorReason(json.code, json.text)
}
val parsed = try {
Json.decodeFromString<CommentResponse>(json.text)
} catch (e: Exception) {