From 5ce14a63f6cfd523148fe53953f91a45ab388787 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 8 Jul 2023 22:50:24 +0200 Subject: Better repo error handling --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 6 +++++- src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 7a81287a3..e19feb339 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -342,7 +342,11 @@ class SkyHanniMod { initLogging() Runtime.getRuntime().addShutdownHook(Thread { configManager.saveConfig("shutdown-hook") }) repo = RepoManager(configManager.configDirectory) - repo.loadRepoInformation() + try { + repo.loadRepoInformation() + } catch (e: Exception) { + Exception("Error reading repo data", e).printStackTrace() + } } fun loadModule(obj: Any) { 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 e1d6aa933..faefb9e33 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data.repo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.LorenzUtils import com.google.gson.JsonObject import net.minecraft.client.Minecraft @@ -122,8 +123,7 @@ class RepoManager(private val configLocation: File) { LorenzUtils.chat("§e[SkyHanni] §a$answerMessage") } } catch (e: java.lang.Exception) { - comp.completeExceptionally(e) - LorenzUtils.error("An error occurred while trying to reload the repo! See logs for more info.") + CopyErrorCommand.logError(e, "Error reading repo data!") } } return comp -- cgit