Update try catch for command handling

Fixes #12729
This commit is contained in:
Nassim Jahnke
2025-06-25 22:42:38 +02:00
parent 7ec3174a33
commit 4e1a2555be

View File

@@ -76,11 +76,15 @@
CommandSourceStack commandSourceStack = parseResults.getContext().getSource();
Profiler.get().push(() -> "/" + command);
ContextChain<CommandSourceStack> contextChain = finishParsing(parseResults, command, commandSourceStack);
@@ -313,9 +_,10 @@
@@ -312,10 +_,13 @@
)
);
}
} catch (Exception var12) {
+ if (throwCommandError) throw var12; // Paper
- } catch (Exception var12) {
+ // Paper start
+ } catch (Throwable var12) { // always gracefully handle it, no matter how bad:tm:
+ if (throwCommandError) throw var12; // rethrow directly if requested
+ // Paper end
MutableComponent mutableComponent = Component.literal(var12.getMessage() == null ? var12.getClass().getName() : var12.getMessage());
- if (LOGGER.isDebugEnabled()) {
- LOGGER.error("Command exception: /{}", command, var12);