[Vulcan/Hebe] Fix error handling.

This commit is contained in:
Kuba Szczodrzyński 2021-02-26 11:52:45 +01:00
parent d201c0c448
commit 58a26cc0c6

View File

@ -221,7 +221,7 @@ open class VulcanHebe(open val data: DataVulcan, open val lastSync: Long?) {
} }
val status = json.getJsonObject("Status") val status = json.getJsonObject("Status")
val statusCode = status?.getInt("Code") ?: -1 val statusCode = status?.getInt("Code") ?: 0
if (statusCode != 0) { if (statusCode != 0) {
val statusMessage = status?.getString("Message") val statusMessage = status?.getString("Message")
val errorCode = when (statusCode) { val errorCode = when (statusCode) {
@ -249,6 +249,7 @@ open class VulcanHebe(open val data: DataVulcan, open val lastSync: Long?) {
.withResponse(response) .withResponse(response)
.withApiResponse(json.toString()) .withApiResponse(json.toString())
) )
return
} }
val envelope = if (json.get("Envelope").isJsonNull && null is T) val envelope = if (json.get("Envelope").isJsonNull && null is T)