aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt16
1 files changed, 13 insertions, 3 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 c2a35027d..a8c6660f3 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
@@ -31,15 +31,25 @@ object CopyErrorCommand {
if (cache.getIfPresent(pair) != null) return
cache.put(pair, Unit)
- val stackTrace = error.stackTraceToString()
+ val stackTrace = error.stackTraceToString().removeSpam()
val randomId = UUID.randomUUID().toString()
errorMessages[randomId] =
- "```\nSkyHanni ${SkyHanniMod.version}: $message\n$stackTrace```"
+ "```\nSkyHanni ${SkyHanniMod.version}: $message\n \n$stackTrace```"
LorenzUtils.clickableChat(
"§c[SkyHanni ${SkyHanniMod.version}]: $message. Click here to copy the error into the clipboard.",
"shcopyerror $randomId"
)
}
-} \ No newline at end of file
+}
+
+private fun String.removeSpam(): String {
+ val ignored = listOf(
+ "at io.netty.",
+ "at net.minecraft.network.",
+ "at net.minecraftforge.fml.common.network.handshake.",
+ "at java.lang.Thread.run",
+ )
+ return split("\r\n\t").filter { line -> !ignored.any { line.startsWith(it) } }.joinToString("\n")
+}