From 4aa469feee9592c6c7ded467216c77f5839e7f2e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 3 Aug 2023 16:43:47 +0200 Subject: more useful api error messages --- src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt index e1763f7d5..6b4bb40f6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.test.command.CopyErrorCommand import com.google.gson.JsonObject import com.google.gson.JsonParser import com.google.gson.JsonSyntaxException @@ -59,10 +60,7 @@ object APIUtil { e.printStackTrace() } else { - println("JsonSyntaxException at getJSONResponse '$urlString'") - LorenzUtils.error("[SkyHanni] JsonSyntaxException at getJSONResponse!") - println("result: '$retSrc'") - e.printStackTrace() + CopyErrorCommand.logError(Error("Hypixel API error for url: '$urlString'", e), "Failed to load data from Hypixel API") } } } @@ -71,8 +69,7 @@ object APIUtil { if (silentError) { throw throwable } else { - throwable.printStackTrace() - LorenzUtils.error("SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst fetching a resource. See logs for more details.") + CopyErrorCommand.logError(Error("Hypixel API error for url: '$urlString'", throwable), "Failed to load data from Hypixel API") } } finally { client.close() -- cgit