fix: better error message
This commit is contained in:
parent
b4c7ea5f26
commit
9d9c4f026d
2 changed files with 5 additions and 1 deletions
|
@ -38,6 +38,10 @@ object CommentsAPI {
|
||||||
val request = requestBuilder()
|
val request = requestBuilder()
|
||||||
val json = request.get(url)
|
val json = request.get(url)
|
||||||
if (!json.text.startsWith("{")) return null
|
if (!json.text.startsWith("{")) return null
|
||||||
|
val res = json.code == 200
|
||||||
|
if (!res) {
|
||||||
|
errorReason(json.code, json.text)
|
||||||
|
}
|
||||||
val parsed = try {
|
val parsed = try {
|
||||||
Json.decodeFromString<CommentResponse>(json.text)
|
Json.decodeFromString<CommentResponse>(json.text)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
android:layout_height="42dp"
|
android:layout_height="42dp"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
style="@style/roundedImageView"
|
style="@style/CircularImageView"
|
||||||
app:srcCompat="@drawable/ic_round_add_circle_24"
|
app:srcCompat="@drawable/ic_round_add_circle_24"
|
||||||
tools:ignore="ContentDescription,ImageContrastCheck" />
|
tools:ignore="ContentDescription,ImageContrastCheck" />
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue