From b7b4c4bde154e6177d03367024a6537133841309 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Wed, 10 May 2023 17:42:26 +1000 Subject: Fix features and copy error (#97) --- .../skyhanni/test/command/CopyErrorCommand.kt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt (limited to 'src/main/java/at/hannibal2/skyhanni/test/command') diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt new file mode 100644 index 000000000..e2fbd98c5 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt @@ -0,0 +1,21 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.OSUtils + +object CopyErrorCommand { + var errorMessage = "" + var errorStackTrace = listOf() + fun command() { + try { + if (errorMessage == "") LorenzUtils.chat("§c[SkyHanni] no error to copy") else { + val result = errorMessage + "\nCaused at:\n" + errorStackTrace.joinToString("\n") + OSUtils.copyToClipboard(result) + LorenzUtils.chat("§e[SkyHanni] error message copied into the clipboard, please report it on the SkyHanni discord!") + } + } catch (error: Throwable) { + OSUtils.copyToClipboard(error.toString()) + LorenzUtils.chat("§c[SkyHanni] error occurred while fetching error, please report this on the SkyHanni discord!") + } + } +} \ No newline at end of file -- cgit