diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-03 16:43:47 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-08-03 16:43:47 +0200 |
commit | 4aa469feee9592c6c7ded467216c77f5839e7f2e (patch) | |
tree | a2093f810c66426e1870314af6ad43ebae100add /src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt | |
parent | 60f6f77cd54b2aba747e6b98d5e6268c7b97bc28 (diff) | |
download | skyhanni-4aa469feee9592c6c7ded467216c77f5839e7f2e.tar.gz skyhanni-4aa469feee9592c6c7ded467216c77f5839e7f2e.tar.bz2 skyhanni-4aa469feee9592c6c7ded467216c77f5839e7f2e.zip |
more useful api error messages
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt | 9 |
1 files 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() |