aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-24 02:06:33 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-24 02:06:33 +0200
commit8a8feae205ea636b626c75e6ace8237d7eb2da8e (patch)
tree03b85d9ab1510dcf228e3a666868056fc5e85234 /src/main/java/at/hannibal2/skyhanni/features/garden
parenta69459a7ce06dced4489a0ad923681c9e6b59715 (diff)
downloadskyhanni-8a8feae205ea636b626c75e6ace8237d7eb2da8e.tar.gz
skyhanni-8a8feae205ea636b626c75e6ace8237d7eb2da8e.tar.bz2
skyhanni-8a8feae205ea636b626c75e6ace8237d7eb2da8e.zip
add more error logging
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
index e2343af02..ba5706f1d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
@@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacks
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorOpenEvent
+import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.NEUInternalName
@@ -50,11 +51,24 @@ class GardenVisitorSupercraft {
val visitor = event.visitor
visitor.offer?.offerItem ?: return
for ((internalName, amount) in visitor.shoppingList) {
- if (isSupercraftEnabled) getSupercraftForSacks(internalName, amount)
+ if (isSupercraftEnabled) {
+ try {
+ getSupercraftForSacks(internalName, amount)
+ } catch (e: NoSuchElementException) {
+ ErrorManager.logErrorWithData(
+ e,
+ "Failed to calculate supercraft recipes for visitor",
+ "internalName" to internalName,
+ "amount" to amount,
+ "visitor" to visitor.visitorName,
+ "visitor.offer?.offerItem" to visitor.offer?.offerItem,
+ )
+ }
+ }
}
}
- fun getSupercraftForSacks(internalName: NEUInternalName, amount: Int) {
+ private fun getSupercraftForSacks(internalName: NEUInternalName, amount: Int) {
val ingredients = NEUItems.getRecipes(internalName)
// TODO describe what this line does
.first { !it.ingredients.first().internalItemId.contains("PEST") }