aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt22
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt6
12 files changed, 90 insertions, 45 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
index 647cb7ec1..5b095fa74 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
@@ -210,11 +210,11 @@ class ConfigManager {
}
logger.log("Loaded $fileName from file")
- } catch (error: Exception) {
- error.printStackTrace()
+ } catch (e: Exception) {
+ e.printStackTrace()
val backupFile = file.resolveSibling("$fileName-${System.currentTimeMillis()}-backup.json")
logger.log("Exception while reading $file. Will load blank $fileName and save backup to $backupFile")
- logger.log("Exception was $error")
+ logger.log("Exception was $e")
try {
file.copyTo(backupFile)
} catch (e: Exception) {
diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
index 380ecbb8e..4a42001df 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt
@@ -83,7 +83,12 @@ class RepoManager(private val configLocation: File) {
latestRepoCommit = commits["sha"].asString
}
} catch (e: Exception) {
- e.printStackTrace()
+ ErrorManager.logErrorWithData(
+ e,
+ "Error while loading data from repo",
+ "command" to command,
+ "currentCommitJSON" to currentCommitJSON,
+ )
}
if (latestRepoCommit == null || latestRepoCommit!!.isEmpty()) return@supplyAsync false
val file = File(configLocation, "repo")
@@ -118,13 +123,12 @@ class RepoManager(private val configLocation: File) {
)
}
} catch (e: IOException) {
- Exception(
- "Failed to download SkyHanni Repo! Please report this issue on the discord!",
- e
- ).printStackTrace()
- if (command) {
- ChatUtils.error("An error occurred while trying to reload the repo! See logs for more info.")
- }
+ ErrorManager.logErrorWithData(
+ e,
+ "Failed to download SkyHanni Repo",
+ "url" to url,
+ "command" to command,
+ )
return@supplyAsync false
}
RepoUtils.unzipIgnoreFirstFolder(
@@ -140,7 +144,11 @@ class RepoManager(private val configLocation: File) {
}
}
} catch (e: Exception) {
- e.printStackTrace()
+ ErrorManager.logErrorWithData(
+ e,
+ "Failed to download SkyHanni Repo",
+ "command" to command,
+ )
}
true
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
index 38a08f8d6..861e17c82 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.data.repo
+import at.hannibal2.skyhanni.test.command.ErrorManager
import com.google.gson.Gson
import java.io.BufferedReader
import java.io.File
@@ -65,7 +66,12 @@ object RepoUtils {
zis.close()
fis.close()
} catch (e: IOException) {
- e.printStackTrace()
+ ErrorManager.logErrorWithData(
+ e,
+ "unzipIgnoreFirstFolder failed",
+ "zipFilePath" to zipFilePath,
+ "destDir" to destDir,
+ )
}
}
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)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
index 33da6ed38..fd1c4030b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
@@ -71,10 +71,15 @@ object APIUtil {
"shtogglehypixelapierrors"
)
}
- e.printStackTrace()
+ ErrorManager.logErrorWithData(
+ e, "502 Bad Gateway",
+ "apiName" to apiName,
+ "urlString" to urlString,
+ "returnedData" to retSrc
+ )
} else {
ErrorManager.logErrorWithData(
- e, "$apiName error for url: '$urlString'",
+ e, "$apiName error",
"apiName" to apiName,
"urlString" to urlString,
"returnedData" to retSrc
@@ -122,10 +127,12 @@ object APIUtil {
} catch (throwable: Throwable) {
if (silentError) {
throw throwable
- } else {
- throwable.printStackTrace()
- ChatUtils.error("SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst sending a resource. See logs for more details.")
}
+ ErrorManager.logErrorWithData(
+ throwable, "SkyHanni ran into an ${throwable::class.simpleName ?: "error"} whilst sending a resource",
+ "urlString" to urlString,
+ "body" to body,
+ )
return ApiResponse(false, throwable.message, JsonObject())
} finally {
client.close()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
index 1050c5c98..558a9b810 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.test.command.ErrorManager
import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper
import io.github.moulberry.moulconfig.internal.KeybindHelper
import net.minecraft.client.Minecraft
@@ -74,8 +75,10 @@ object KeyboardManager {
try {
if (keyCode.isKeyHeld()) return true
} catch (e: IndexOutOfBoundsException) {
- println("KeyBinding isActive caused an IndexOutOfBoundsException with keyCode: $keyCode")
- e.printStackTrace()
+ ErrorManager.logErrorWithData(
+ e, "Error while checking if a key is pressed.",
+ "keyCode" to keyCode,
+ )
return false
}
return this.isKeyDown || this.isPressed
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 914a906e5..6b25d2992 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -13,7 +13,6 @@ import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned
import at.hannibal2.skyhanni.utils.shader.ShaderManager
import io.github.moulberry.moulconfig.internal.TextRenderUtils
import io.github.moulberry.notenoughupdates.util.Utils
-import java.awt.Color
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.FontRenderer
import net.minecraft.client.gui.Gui
@@ -29,6 +28,7 @@ import net.minecraft.util.AxisAlignedBB
import net.minecraft.util.MathHelper
import net.minecraft.util.ResourceLocation
import org.lwjgl.opengl.GL11
+import java.awt.Color
import kotlin.math.cos
import kotlin.math.sin
import kotlin.math.sqrt
@@ -462,15 +462,10 @@ object RenderUtils {
offsetY += 10 + extraSpace + 2
}
} catch (e: NullPointerException) {
- println(" ")
- for (innerList in list) {
- println("new inner list:")
- for (any in innerList) {
- println("any: '$any'")
- }
- }
- e.printStackTrace()
- ChatUtils.debug("NPE in renderStringsAndItems!")
+ ErrorManager.logErrorWithData(
+ e, "Failed to render an element",
+ "list" to list
+ )
}
GuiEditManager.add(this, posLabel, longestX, offsetY)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
index f9a330f20..2a5f7e0e0 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SoundUtils.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.test.command.ErrorManager
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import net.minecraft.client.Minecraft
@@ -33,7 +34,10 @@ object SoundUtils {
}
}
}
- e.printStackTrace()
+ ErrorManager.logErrorWithData(
+ e, "Failed to play a sound",
+ "soundLocation" to this.soundLocation
+ )
} finally {
gameSettings.setSoundLevel(SoundCategory.PLAYERS, oldLevel)
}