error handling
This commit is contained in:
@@ -25,6 +25,7 @@ public class CommandProcessor {
|
||||
@Incoming("command")
|
||||
@Outgoing("command-replies")
|
||||
public CommandWrapper process(CommandWrapper request) throws IOException {
|
||||
try {
|
||||
ThrowingFunction<CommandWrapper, Command, IOException> processor = processors.get(request.getType());
|
||||
if (processor == null) {
|
||||
CommandException e = new CommandException();
|
||||
@@ -33,6 +34,11 @@ public class CommandProcessor {
|
||||
}
|
||||
|
||||
return processor.apply(request).serialize().copyIds(request);
|
||||
} catch (Throwable t) {
|
||||
CommandException e = new CommandException();
|
||||
e.setException(t.getMessage());
|
||||
return e.serialize().copyIds(request);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
||||
Reference in New Issue
Block a user