aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-06 23:12:44 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-06 23:12:44 +0100
commit139a55b1c40ba5fa7eeae352cdde5034516a150d (patch)
tree80e16fe3f6161f4bc4c459ccb659d0d3e57170b9 /src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
parent362e3efddab52c954a46766e217d6b4faba5332e (diff)
downloadskyhanni-139a55b1c40ba5fa7eeae352cdde5034516a150d.tar.gz
skyhanni-139a55b1c40ba5fa7eeae352cdde5034516a150d.tar.bz2
skyhanni-139a55b1c40ba5fa7eeae352cdde5034516a150d.zip
debug command logic and console filter changes
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
index 5584da0fe..908d8b810 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.SkyHanniMod
import com.google.gson.JsonObject
import com.google.gson.JsonParser
+import com.google.gson.stream.MalformedJsonException
import org.apache.http.client.config.RequestConfig
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.HttpClientBuilder
@@ -40,7 +41,13 @@ object APIUtil {
val entity = response.entity
if (entity != null) {
val retSrc = EntityUtils.toString(entity)
- return parser.parse(retSrc) as JsonObject
+ try {
+ return parser.parse(retSrc) as JsonObject
+ } catch (e: MalformedJsonException) {
+ LorenzUtils.error("MalformedJsonException!")
+ println("MalformedJsonException at '$urlString'")
+ e.printStackTrace()
+ }
}
}
} catch (throwable: Throwable) {