From 25962a047b310662f923917d96cd96a1d3a16965 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:54:43 +0200 Subject: sending the normal stack trace in the console as normal --- .../at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt index ccaeee6ef..112768637 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt @@ -36,15 +36,17 @@ object CopyErrorCommand { } ?: "§c[SkyHanni] Error id not found!") } - fun logError(error: Throwable, message: String) { - Minecraft.getMinecraft().thePlayer ?: throw Error(message, error) + fun logError(throwable: Throwable, message: String) { + val error = Error(message, throwable) + Minecraft.getMinecraft().thePlayer ?: throw error + error.printStackTrace() - val pair = error.stackTrace[0].let { it.fileName to it.lineNumber } + val pair = throwable.stackTrace[0].let { it.fileName to it.lineNumber } if (cache.getIfPresent(pair) != null) return cache.put(pair, Unit) - val fullStackTrace = error.getExactStackTrace(true).joinToString("\n") - val stackTrace = error.getExactStackTrace(false).joinToString("\n").removeSpam() + val fullStackTrace = throwable.getExactStackTrace(true).joinToString("\n") + val stackTrace = throwable.getExactStackTrace(false).joinToString("\n").removeSpam() val randomId = UUID.randomUUID().toString() errorMessages[randomId] = "```\nSkyHanni ${SkyHanniMod.version}: $message\n \n$stackTrace\n```" -- cgit