revert attempts related to exception handling

This commit is contained in:
onebeastchris 2024-03-08 19:48:55 +01:00
parent 677f79dbd7
commit ba3bd43e6e
1 changed files with 3 additions and 5 deletions

View File

@ -55,7 +55,6 @@ import org.geysermc.geyser.extension.command.GeyserExtensionCommand;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.geyser.text.GeyserLocale;
import org.incendo.cloud.CommandManager;
import org.incendo.cloud.context.CommandContext;
import org.incendo.cloud.exception.ArgumentParseException;
import org.incendo.cloud.exception.CommandExecutionException;
import org.incendo.cloud.exception.InvalidCommandSenderException;
@ -257,7 +256,7 @@ public class CommandRegistry {
}
try {
handleThrowable(source, result.commandContext(), throwable);
handleThrowable(source, throwable);
} catch (Throwable secondary) {
// otherwise it gets swallowed by whenComplete.
// we assume this won't throw.
@ -266,9 +265,8 @@ public class CommandRegistry {
});
}
private void handleThrowable(@NonNull GeyserCommandSource source, @NonNull CommandContext<GeyserCommandSource> commandContext, @NonNull Throwable throwable) {
private void handleThrowable(@NonNull GeyserCommandSource source, @NonNull Throwable throwable) {
if (throwable instanceof Exception exception) {
cloud.exceptionController().handleException(commandContext, exception);
for (ExceptionHandler<?> handler : exceptionHandlers) {
if (handler.handle(source, exception)) {
return;
@ -318,7 +316,7 @@ public class CommandRegistry {
E e = (E) exception;
// if cloud has a registered exception handler for this type, use it, otherwise use this handler.
// we register all the exception handlers to cloud, so it will likely just be cloud invoking this same handler.
cloud.exceptionController().handleException(source, type, e, handler);
cloud.handleException(source, type, e, handler);
return true;
}
return false;