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-08-03 16:43:47 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-03 16:43:47 +0200
commit4aa469feee9592c6c7ded467216c77f5839e7f2e (patch)
treea2093f810c66426e1870314af6ad43ebae100add /src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
parent60f6f77cd54b2aba747e6b98d5e6268c7b97bc28 (diff)
downloadskyhanni-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.kt9
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()