mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Handle binary error messages better.
This commit is contained in:
parent
cc183a8b23
commit
9ab34a4efc
1 changed files with 6 additions and 2 deletions
|
@ -37,8 +37,12 @@ open public class UnauthenticatedBintrayApi @Inject constructor(open val http: H
|
|||
val networkResponse = r.networkResponse()
|
||||
if (networkResponse.code() != 200) {
|
||||
val message = networkResponse.message()
|
||||
val errorObject = JsonParser().parse(r.body().string()).asJsonObject
|
||||
return BintrayResponse(null, message + ": " + errorObject.get("message").asString)
|
||||
try {
|
||||
val errorObject = JsonParser().parse(r.body().string()).asJsonObject
|
||||
return BintrayResponse(null, message + ": " + errorObject.get("message").asString)
|
||||
} catch(ex: Exception) {
|
||||
return BintrayResponse(null, message)
|
||||
}
|
||||
} else {
|
||||
return BintrayResponse(JsonParser().parse(r.body().string()).asJsonObject, null)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue