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 --- .../features/garden/GardenNextJacobContest.kt | 22 ++++++++++++++++------ .../features/garden/composter/ComposterOverlay.kt | 7 +++++-- .../features/garden/farming/CropMoneyDisplay.kt | 8 +++++++- .../features/misc/items/EstimatedItemValue.kt | 7 ++++--- .../reputationhelper/dailyquest/QuestLoader.kt | 6 ++++-- 5 files changed, 36 insertions(+), 14 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 6fce2122d..8b38e801b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon +import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConfigUtils @@ -451,7 +452,10 @@ object GardenNextJacobContest { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) } catch (e: java.lang.Exception) { - e.printStackTrace() + ErrorManager.logErrorWithData( + e, "Failed to open a popup window", + "message" to message + ) } val frame = JFrame() @@ -571,8 +575,11 @@ object GardenNextJacobContest { saveConfig() } } catch (e: Exception) { - e.printStackTrace() - ChatUtils.error("Failed to fetch upcoming contests. Please report this error if it continues to occur.") + ErrorManager.logErrorWithData( + e, + "Failed to fetch upcoming contests. Please report this error if it continues to occur" + ) + } } @@ -604,11 +611,14 @@ object GardenNextJacobContest { if (result) { ChatUtils.chat("Successfully submitted this years upcoming contests, thank you for helping everyone out!") } else { - ChatUtils.error("Something went wrong submitting upcoming contests!") + ErrorManager.logErrorStateWithData("Something went wrong submitting upcoming contests!", + "submitContestsToElite not sucessful") } } catch (e: Exception) { - e.printStackTrace() - ChatUtils.error("Failed to submit upcoming contests. Please report this error if it continues to occur.") + ErrorManager.logErrorWithData( + e, "Failed to submit upcoming contests. Please report this error if it continues to occur.", + "contests" to contests + ) null } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 08e6382c1..48c2f8a0c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.features.bazaar.BazaarApi import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.composter.ComposterAPI.getLevel import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue +import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc @@ -550,8 +551,10 @@ object ComposterOverlay { try { organicMatterFactors = updateOrganicMatterFactors(organicMatter) } catch (e: Exception) { - e.printStackTrace() - ChatUtils.error("error in RepositoryReloadEvent") + ErrorManager.logErrorWithData( + e, "Failed to calculate composter overlay data", + "organicMatter" to organicMatter + ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 83a4c68ca..84e63ce18 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.CropType.Companion.getByNameOrNull import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenNextJacobContest +import at.hannibal2.skyhanni.features.garden.composter.ComposterOverlay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.isSpeedDataEmpty import at.hannibal2.skyhanni.test.command.ErrorManager @@ -204,7 +205,12 @@ object CropMoneyDisplay { list.add(getItemStack("BOX_OF_SEEDS")) } } catch (e: NullPointerException) { - e.printStackTrace() + ErrorManager.logErrorWithData( + e, "Error calculating seed price for money per hour display", + "internalName" to internalName, + "cropNames" to cropNames, + "list" to list, + ) } if (!config.compact) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index 2d6c37469..f350991ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -16,7 +16,6 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.isRune @@ -158,9 +157,11 @@ object EstimatedItemValue { } catch (e: Exception) { ErrorManager.logErrorWithData( e, "Error in Estimated Item Value renderer", + "openInventoryName" to openInventoryName, "item" to item, - "itemName" to item.itemName, - "getInternalName" to item.getInternalName(), + "item name" to item.itemName, + "internal name" to item.getInternalNameOrNull(), + "lore" to item.getLore(), ) listOf() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index 4dd526dbe..7202e1047 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -184,8 +184,10 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { val haveAmount = split[3].toInt() quest.haveAmount = haveAmount } catch (e: IndexOutOfBoundsException) { - println("text: '$text'") - e.printStackTrace() + ErrorManager.logErrorWithData( + e, "Error loading Crimson Isle Quests from config.", + "text" to text, + ) } } addQuest(quest) -- cgit