diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-03-01 21:51:05 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 11:51:05 +0100 |
commit | a0b81d3592883225988e058b7de87d33fa2dddf3 (patch) | |
tree | 14ae161cfa4104cc6e4085d0a341e27740decb97 /src/main/java | |
parent | 8e9109d3b190f5451793fe79929ac89b3876c4ff (diff) | |
download | skyhanni-a0b81d3592883225988e058b7de87d33fa2dddf3.tar.gz skyhanni-a0b81d3592883225988e058b7de87d33fa2dddf3.tar.bz2 skyhanni-a0b81d3592883225988e058b7de87d33fa2dddf3.zip |
Replaced e.printStackTrace() with ErrorManager. #1065
Diffstat (limited to 'src/main/java')
17 files changed, 32 insertions, 34 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index e7b1679cd..eaa7f87cf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -431,7 +431,6 @@ class FarmingWeightDisplay { "url" to url, "apiResponse" to apiResponse ) - error() } return -1 } @@ -470,13 +469,10 @@ class FarmingWeightDisplay { ErrorManager.logErrorWithData( e, "Error loading user farming weight", "url" to url, - "apiResponse" to apiResponse + "apiResponse" to apiResponse, + "localProfile" to localProfile ) } - error() - } - - private fun error() { apiError = true ErrorManager.skyHanniError( "Loading the farming weight data from elitebot.dev failed!\n" diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 0ac715598..eec532ed1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -116,7 +116,7 @@ object GardenCropMilestoneDisplay { } cultivatingData[crop] = counter } catch (e: Throwable) { - ErrorManager.logError(e, "Updating crop counter by reading farming tool nbt data.") + ErrorManager.logErrorWithData(e, "Updating crop counter by reading farming tool nbt data.") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 1274bf2e8..4b74271e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -170,7 +170,7 @@ object GardenVisitorDropStatistics { ) } else { addAsSingletonList("§c?") - ErrorManager.logError( + ErrorManager.logErrorWithData( RuntimeException("visitorRarities is empty, maybe visitor refusing was the cause?"), "Error rendering visitor drop statistics" ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index c631165d3..09e02c94f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -70,7 +70,7 @@ class GardenVisitorTimer { try { updateVisitorDisplay() } catch (error: Throwable) { - ErrorManager.logError(error, "Encountered an error when updating visitor display") + ErrorManager.logErrorWithData(error, "Encountered an error when updating visitor display") } try { GardenVisitorDropStatistics.saveAndUpdate() diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt index a5a9c8900..daaf6c8be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt @@ -200,9 +200,9 @@ class NonGodPotEffectDisplay { val duration = try { TimeUtils.getMillis(line.split("§f")[1]) } catch (e: IndexOutOfBoundsException) { - ErrorManager.logError( - Exception("'§f' not found in line '$line'", e), - "Error while reading Non God-Potion effects from tab list" + ErrorManager.logErrorWithData( + e, "Error while reading Non God-Potion effects from tab list", + "line" to line ) continue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index f1fb205e5..2d241dd9c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -179,7 +179,7 @@ object QuickModMenuSwitch { } } } catch (e: Exception) { - ErrorManager.logError(e, "Error trying to open the gui for mod " + mod.name) + ErrorManager.logErrorWithData(e, "Error trying to open the gui for mod " + mod.name) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt index 5110c3752..bc7875822 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/discordrpc/DiscordRPCManager.kt @@ -211,7 +211,7 @@ object DiscordRPCManager : IPCListener { try { start(true) } catch (e: Exception) { - ErrorManager.logError( + ErrorManager.logErrorWithData( e, "Unable to start Discord Rich Presence! Please report this on Discord and ping @netheriteminer." ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 11d6e68ad..ffd25c4e1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -94,7 +94,7 @@ object TrevorFeatures { TrevorTracker.calculatePeltsPerHour() if (questActive) TrevorSolver.findMob() } catch (error: Throwable) { - ErrorManager.logError(error, "Encountered an error when updating the trapper solver") + ErrorManager.logErrorWithData(error, "Encountered an error when updating the trapper solver") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt index a52c9d208..79d6cc130 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/visualwords/VisualWordGui.kt @@ -591,8 +591,8 @@ open class VisualWordGui : GuiScreen() { SkyHanniMod.feature.storage.visualWordsImported = true drawImport = false } - } catch (t: Throwable) { - ErrorManager.logError(t, "Failed to load visual words from SBE") + } catch (e: Throwable) { + ErrorManager.logErrorWithData(e, "Failed to load visual words from SBE") } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt index bb80462da..d2e5f389e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt @@ -117,9 +117,11 @@ object SkyHanniConfigSearchResetCommand { "§eChanged config element $term to $rawJson." } catch (e: Exception) { ErrorManager.logErrorWithData( - e, "Could not change config element '$term' to '$rawJson'", + e, "Could not change config element", + "term" to term, + "rawJson" to rawJson, "args" to args.joinToString(" ") - ) + ) "§cCould not change config element '$term' to '$rawJson'" } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 9d3a6f4c9..4cd3a9bfd 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -80,11 +80,6 @@ object ErrorManager { } ?: "Error id not found!") } - @Deprecated("Use data as well", ReplaceWith("ErrorManager.logErrorStateWithData(userMessage, internalMessage)")) - fun logErrorState(userMessage: String, internalMessage: String) { - logError(IllegalStateException(internalMessage), userMessage, ignoreErrorCache = false, noStackTrace = false) - } - fun logErrorStateWithData( userMessage: String, internalMessage: String, diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt index b1d8eb68b..0c55b894c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ClipboardUtils.kt @@ -46,7 +46,7 @@ object ClipboardUtils { getClipboard()?.setContents(StringSelection(text), null) } catch (e: Exception) { if (step == 3) { - ErrorManager.logError(e, "Error while trying to access the clipboard.") + ErrorManager.logErrorWithData(e, "Error while trying to access the clipboard.") } else { copyToClipboard(text, step + 1) } @@ -65,7 +65,7 @@ object ClipboardUtils { } } catch (e: Exception) { return if (step == 3) { - ErrorManager.logError(e, "Error while trying to access the clipboard.") + ErrorManager.logErrorWithData(e, "Error while trying to access the clipboard.") null } else { readFromClipboard(step + 1) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index 1da7170ac..4774e4e7a 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -65,7 +65,7 @@ object InventoryUtils { val booleanField = storage.javaClass.getDeclaredField("enableStorageGUI3") booleanField.get(storage) as Boolean } catch (e: Throwable) { - ErrorManager.logError(e, "Could not read NEU config to determine if the neu storage is emabled.") + ErrorManager.logErrorWithData(e, "Could not read NEU config to determine if the neu storage is emabled.") false } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index 39c877db0..fdac1a4a8 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -53,7 +53,7 @@ enum class LorenzColor(private val chatColorCode: Char, private val color: Color EnumDyeColor.PURPLE -> DARK_PURPLE EnumDyeColor.YELLOW -> YELLOW else -> { - ErrorManager.logError( + ErrorManager.logErrorWithData( Exception("Unknown dye color: $this"), "Unknown dye color: $this" ) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 1ca6e2a70..62f49f42f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -139,11 +139,13 @@ object NEUItems { getItemStackOrNull() ?: run { getPriceOrNull() ?: return@run fallbackItem if (ignoreItemsFilter.match(this.asString())) return@run fallbackItem - ErrorManager.logError( + ErrorManager.logErrorWithData( IllegalStateException("Something went wrong!"), "Encountered an error getting the item for §7$this§c. " + "This may be because your NEU repo is outdated. Please ask in the SkyHanni " + - "Discord if this is the case" + "Discord if this is the case.", + "Item name" to this.asString(), + "repo commit" to manager.latestRepoCommit ) fallbackItem } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt index 0cb4e043e..812bf085f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt @@ -13,11 +13,14 @@ object OSUtils { try { Desktop.getDesktop().browse(URI(url)) } catch (e: IOException) { - ErrorManager.logError(e, "Error opening website: $url") + ErrorManager.logErrorWithData( + e, "Error while opening website.", + "url" to url + ) } } else { copyToClipboard(url) - ChatUtils.error("Web browser is not supported! Copied url to clipboard.") + ErrorManager.skyHanniError("Cannot open website, web browser is not supported! Copied url to clipboard.") } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index 14787a980..2e4f16ba6 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -43,7 +43,7 @@ class ParkourHelper( fun render(event: LorenzRenderWorldEvent) { if (locations.isEmpty()) { - ErrorManager.logError( + ErrorManager.logErrorWithData( IllegalArgumentException("locations is empty"), "Trying to render an empty parkour" ) @@ -125,7 +125,7 @@ class ParkourHelper( } } } catch (e: Throwable) { - ErrorManager.logError(e, "Error while rendering a parkour") + ErrorManager.logErrorWithData(e, "Error while rendering a parkour") } } |