aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-16 14:01:52 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-16 14:01:52 +0200
commit45428b06e4cc99255a358f9e9dd34515670c70f5 (patch)
treec74183bc37067581ed523ce1f5700c4f13404654 /src
parentd130af8e45d26b2403781babad93b65092e754fc (diff)
downloadskyhanni-45428b06e4cc99255a358f9e9dd34515670c70f5.tar.gz
skyhanni-45428b06e4cc99255a358f9e9dd34515670c70f5.tar.bz2
skyhanni-45428b06e4cc99255a358f9e9dd34515670c70f5.zip
made copied error logs smaller
Diffstat (limited to 'src')
-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")
+}