From 498eb136629d3f2b22f217ebec60b60761e1b899 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Fri, 1 Mar 2024 09:06:59 +0100 Subject: printStackTrace -> ErrorManager #1028 --- .../at/hannibal2/skyhanni/data/repo/RepoManager.kt | 26 ++++++++++++++-------- .../at/hannibal2/skyhanni/data/repo/RepoUtils.kt | 8 ++++++- 2 files changed, 24 insertions(+), 10 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index 380ecbb8e..4a42001df 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -83,7 +83,12 @@ class RepoManager(private val configLocation: File) { latestRepoCommit = commits["sha"].asString } } catch (e: Exception) { - e.printStackTrace() + ErrorManager.logErrorWithData( + e, + "Error while loading data from repo", + "command" to command, + "currentCommitJSON" to currentCommitJSON, + ) } if (latestRepoCommit == null || latestRepoCommit!!.isEmpty()) return@supplyAsync false val file = File(configLocation, "repo") @@ -118,13 +123,12 @@ class RepoManager(private val configLocation: File) { ) } } catch (e: IOException) { - Exception( - "Failed to download SkyHanni Repo! Please report this issue on the discord!", - e - ).printStackTrace() - if (command) { - ChatUtils.error("An error occurred while trying to reload the repo! See logs for more info.") - } + ErrorManager.logErrorWithData( + e, + "Failed to download SkyHanni Repo", + "url" to url, + "command" to command, + ) return@supplyAsync false } RepoUtils.unzipIgnoreFirstFolder( @@ -140,7 +144,11 @@ class RepoManager(private val configLocation: File) { } } } catch (e: Exception) { - e.printStackTrace() + ErrorManager.logErrorWithData( + e, + "Failed to download SkyHanni Repo", + "command" to command, + ) } true } diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt index 38a08f8d6..861e17c82 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.data.repo +import at.hannibal2.skyhanni.test.command.ErrorManager import com.google.gson.Gson import java.io.BufferedReader import java.io.File @@ -65,7 +66,12 @@ object RepoUtils { zis.close() fis.close() } catch (e: IOException) { - e.printStackTrace() + ErrorManager.logErrorWithData( + e, + "unzipIgnoreFirstFolder failed", + "zipFilePath" to zipFilePath, + "destDir" to destDir, + ) } } -- cgit