1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Better error logging from JCenter.

This commit is contained in:
Cedric Beust 2015-11-14 11:39:10 -08:00
parent ffb0397a3c
commit 658858e87e

View file

@ -36,7 +36,9 @@ open public class UnauthenticatedJCenterApi @Inject constructor(open val http: H
fun parseResponse(r: Response) : JCenterResponse {
val networkResponse = r.networkResponse()
if (networkResponse.code() != 200) {
return JCenterResponse(null, networkResponse.message())
val message = networkResponse.message()
val errorObject = JsonParser().parse(r.body().string()).asJsonObject
return JCenterResponse(null, message + ": " + errorObject.get("message").asString)
} else {
return JCenterResponse(JsonParser().parse(r.body().string()).asJsonObject, null)
}