diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-22 13:00:47 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-06-22 13:00:47 +0200 |
commit | 3e7aa9855489888283b6c53ce14002fe38d04dbe (patch) | |
tree | 9300e8176ac357f0c5637209196dd65f4c287d5c /src/main/java/at/hannibal2/skyhanni/config/commands | |
parent | 47ac0f99f9d482c3ab3baf794d9ebf03fbee3d6b (diff) | |
download | skyhanni-3e7aa9855489888283b6c53ce14002fe38d04dbe.tar.gz skyhanni-3e7aa9855489888283b6c53ce14002fe38d04dbe.tar.bz2 skyhanni-3e7aa9855489888283b6c53ce14002fe38d04dbe.zip |
better error handling
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config/commands')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt | 8 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java | 9 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index ebcb72d28..59b850784 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -125,9 +125,9 @@ object Commands { } private fun createCommand(function: (Array<String>) -> Unit) = - object : ProcessCommandRunnable() { - override fun processCommand(sender: ICommandSender?, args: Array<out String>) { - function(args.asList().toTypedArray()) - } + object : ProcessCommandRunnable() { + override fun processCommand(sender: ICommandSender?, args: Array<out String>) { + function(args.asList().toTypedArray()) } + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java index 25e3ba97b..fa2c310de 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.config.commands; +import at.hannibal2.skyhanni.test.command.CopyErrorCommand; import net.minecraft.command.CommandBase; import net.minecraft.command.ICommandSender; import net.minecraft.util.BlockPos; @@ -7,7 +8,7 @@ import net.minecraft.util.BlockPos; import java.util.List; /** - @author Moulberry + * @author Moulberry **/ public class SimpleCommand extends CommandBase { @@ -50,7 +51,11 @@ public class SimpleCommand extends CommandBase { @Override public void processCommand(ICommandSender sender, String[] args) { - runnable.processCommand(sender, args); + try { + runnable.processCommand(sender, args); + } catch (Throwable e) { + CopyErrorCommand.INSTANCE.logError(e, "Error while running command /" + commandName); + } } @Override |