error handling

This commit is contained in:
2025-10-22 21:29:43 +02:00
parent 032e3ed227
commit 67ced02756

View File

@@ -25,6 +25,7 @@ public class CommandProcessor {
@Incoming("command") @Incoming("command")
@Outgoing("command-replies") @Outgoing("command-replies")
public CommandWrapper process(CommandWrapper request) throws IOException { public CommandWrapper process(CommandWrapper request) throws IOException {
try {
ThrowingFunction<CommandWrapper, Command, IOException> processor = processors.get(request.getType()); ThrowingFunction<CommandWrapper, Command, IOException> processor = processors.get(request.getType());
if (processor == null) { if (processor == null) {
CommandException e = new CommandException(); CommandException e = new CommandException();
@@ -33,6 +34,11 @@ public class CommandProcessor {
} }
return processor.apply(request).serialize().copyIds(request); return processor.apply(request).serialize().copyIds(request);
} catch (Throwable t) {
CommandException e = new CommandException();
e.setException(t.getMessage());
return e.serialize().copyIds(request);
}
} }
@Transactional @Transactional