aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-19 12:55:46 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-19 12:55:46 +0100
commitbd0283998631bac9c433de6ace58e71d32a2123d (patch)
tree2f1dd5ef332f83ab39bc9c0c0d4059a2906110c9 /src
parent6bdcc845e8397041c44b5271af245597caf26353 (diff)
downloadskyhanni-bd0283998631bac9c433de6ace58e71d32a2123d.tar.gz
skyhanni-bd0283998631bac9c433de6ace58e71d32a2123d.tar.bz2
skyhanni-bd0283998631bac9c433de6ace58e71d32a2123d.zip
logError -> logErrorWithData
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/FriendAPI.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt7
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)
}