aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-13 19:53:19 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-01-13 19:53:19 +0100
commitf91ec749011d318af0b823535daed4aef890db5f (patch)
treed437fc2cba90b2d56068ef9b21341318603bc027 /src/main
parent202675df454c4a4565052f12ede037c7212631ab (diff)
downloadskyhanni-f91ec749011d318af0b823535daed4aef890db5f.tar.gz
skyhanni-f91ec749011d318af0b823535daed4aef890db5f.tar.bz2
skyhanni-f91ec749011d318af0b823535daed4aef890db5f.zip
Better explanation for the bazaar api error.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
index 908d8b810..d776cfa01 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
@@ -3,7 +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 com.google.gson.JsonSyntaxException
import org.apache.http.client.config.RequestConfig
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.HttpClientBuilder
@@ -43,9 +43,15 @@ object APIUtil {
val retSrc = EntityUtils.toString(entity)
try {
return parser.parse(retSrc) as JsonObject
- } catch (e: MalformedJsonException) {
- LorenzUtils.error("MalformedJsonException!")
- println("MalformedJsonException at '$urlString'")
+ } catch (e: JsonSyntaxException) {
+ if (retSrc.contains("<center><h1>502 Bad Gateway</h1></center>")) {
+ println("502 Bad Gateway at getJSONResponse '$urlString'")
+ LorenzUtils.error("[SkyHanni] Hypixel API error: 502 Bad Gateway!")
+ } else {
+ println("JsonSyntaxException at getJSONResponse '$urlString'")
+ LorenzUtils.error("[SkyHanni] JsonSyntaxException at getJSONResponse!")
+ println("result: '$retSrc'")
+ }
e.printStackTrace()
}
}