aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-03-01 09:06:59 +0100
committerGitHub <noreply@github.com>2024-03-01 09:06:59 +0100
commit498eb136629d3f2b22f217ebec60b60761e1b899 (patch)
treea34cc8ab028d7e7b069dfc561692a0b0880e5fcf /src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
parent8b0e4335fd4876bb4dfb2325200118435aae2624 (diff)
downloadskyhanni-498eb136629d3f2b22f217ebec60b60761e1b899.tar.gz
skyhanni-498eb136629d3f2b22f217ebec60b60761e1b899.tar.bz2
skyhanni-498eb136629d3f2b22f217ebec60b60761e1b899.zip
printStackTrace -> ErrorManager #1028
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
index 33da6ed38..fd1c4030b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
@@ -71,10 +71,15 @@ object APIUtil {
"shtogglehypixelapierrors"
)
}
- e.printStackTrace()
+ ErrorManager.logErrorWithData(
+ e, "502 Bad Gateway",
+ "apiName" to apiName,
+ "urlString" to urlString,
+ "returnedData" to retSrc
+ )
} else {
ErrorManager.logErrorWithData(
- e, "$apiName error for url: '$urlString'",
+ e, "$apiName error",
"apiName" to apiName,
"urlString" to urlString,
"returnedData" to retSrc
@@ -122,10 +127,12 @@ object APIUtil {
} catch (throwable: Throwable) {
if (silentError) {
throw throwable
- } else {
- throwable.printStackTrace()
- ChatUtils.error("SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst sending a resource. See logs for more details.")
}
+ ErrorManager.logErrorWithData(
+ throwable, "SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst sending a resource",
+ "urlString" to urlString,
+ "body" to body,
+ )
return ApiResponse(false, throwable.message, JsonObject())
} finally {
client.close()