diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
4 files changed, 27 insertions, 18 deletions
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) } |
