diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
7 files changed, 42 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt index 764f1243d..bca46dbd6 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt @@ -39,10 +39,10 @@ class SimpleCommand : CommandBase { try { runnable.processCommand(sender, args) } catch (e: Throwable) { - ErrorManager.logError(e, "Error while running command /$commandName") + ErrorManager.logErrorWithData(e, "Error while running command /$commandName") } } override fun addTabCompletionOptions(sender: ICommandSender, args: Array<String>, pos: BlockPos) = if (tabRunnable != null) tabRunnable!!.tabComplete(sender, args, pos) else null -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt index 0f44a9107..f6c9b4e56 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt @@ -101,7 +101,14 @@ object FriendAPI { try { UUID.fromString(it) } catch (e: IllegalArgumentException) { - ErrorManager.logError(e, "Error reading friend list.") + ErrorManager.logErrorWithData( + e, "Error reading friend list.", + "raw uuid" to it, + "value" to value, + "chatStyle" to chatStyle, + "event.chatComponent" to event.chatComponent, + "event.message" to event.message, + ) return } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 4f202fc62..ebe6e9397 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -361,7 +361,10 @@ class DamageIndicatorManager { entityData.timeLastTick = System.currentTimeMillis() return entity.uniqueID to entityData } catch (e: Throwable) { - ErrorManager.logError(e, "Error checking damage indicator entity $entity") + ErrorManager.logErrorWithData( + e, "Error checking damage indicator entity", + "entity" to entity, + ) return null } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt index 6617b31b2..5f576ae46 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt @@ -36,7 +36,12 @@ object TrophyFishManager { fun TrophyFishInfo.getFilletValue(rarity: TrophyRarity): Int { if (fillet == null) { - ErrorManager.logError(Error("fillet is null for '$displayName'"), "Error trying to read trophy fish info") + ErrorManager.logErrorStateWithData( + "Error trying to read trophy fish info", + "fillet in TrophyFishInfo is null", + "displayName" to displayName, + "TrophyFishInfo" to this, + ) return -1 } return fillet.getOrDefault(rarity, -1) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index b9c3520ae..57335d227 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -57,7 +58,12 @@ class AnitaMedalProfit { try { readItem(item, table) } catch (e: Throwable) { - ErrorManager.logError(e, "Error in AnitaMedalProfit while reading item '$item'") + ErrorManager.logErrorWithData( + e, "Error in AnitaMedalProfit while reading item '${item.nameWithEnchantment}'", + "item" to item, + "name" to item.nameWithEnchantment, + "inventory name" to InventoryUtils.openInventoryName(), + ) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt index 467dad0ff..cfb679c30 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt @@ -25,7 +25,6 @@ class PetExpTooltip { private val level100Common = 5_624_785 private val level100Legendary = 25_353_230 private val level200 = 210_255_385 - private var debugInfoPrinted = false @SubscribeEvent(priority = EventPriority.LOWEST) fun onItemTooltipLow(event: ItemTooltipEvent) { @@ -59,21 +58,15 @@ class PetExpTooltip { event.toolTip.add(index, "§7Progress to ${addLegendaryColor}Level $maxLevel: §e$percentageFormat") } } catch (e: Exception) { - if (!debugInfoPrinted) { - println(" ") - println("PetExpTooltip debug:") - println("itemStack: $itemStack") - println("itemStack.name: $name") - println("petExperience: $petExperience") - println("event.toolTip: ${event.toolTip}") - println(" ") - println("findIndex(event.toolTip): ${findIndex(event.toolTip)}") - println(" ") - println("itemStack.getLore(): ${itemStack.getLore()}") - println(" ") - debugInfoPrinted = true - } - ErrorManager.logError(e, "Could not add pet exp tooltip. Show the console for more info") + ErrorManager.logErrorWithData( + e, "Could not add pet exp tooltip", + "itemStack" to itemStack, + "item name" to name, + "petExperience" to petExperience, + "toolTip" to event.toolTip, + "index" to findIndex(event.toolTip), + "getLore" to itemStack.getLore(), + ) } } 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 0e7bccab6..cc24fbd5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -56,7 +56,12 @@ object ErrorManager { logError(IllegalStateException(internalMessage), userMessage, false, *extraData) } - fun logError(throwable: Throwable, message: String, vararg extraData: Pair<String, Any?>) { + @Deprecated("Use data as well", ReplaceWith("logErrorWithData()")) + fun logError(throwable: Throwable, message: String) { + logError(throwable, message, false) + } + + fun logErrorWithData(throwable: Throwable, message: String, vararg extraData: Pair<String, Any?>) { logError(throwable, message, false, *extraData) } |