error handling
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user