Hi everyone,
I am currently using axon & axon server v4.1, in a spring boot application, and I am having difficulty getting a custom error (checked not runtime) back from the command handler that throws it.
I have tried using the default Command Gateway and creating my own custom Command Gateway as the documentation suggests
https://docs.axoniq.io/reference-guide/configuring-infrastructure-components/command-processing/command-dispatching#creating-a-custom-command-gateway
It reads that any declared exceptions on the method will be thrown, while any undeclared will be wrapped in a CommandExecutionException, but I can only get the later.
This is the test Command Gateway and the initialization I have setup.
`
public interface TestCommandGateway {
void sendCommandAndWait(Object command)
throws TestException, InterruptedException;
CompletableFuture send(Object command) throws TestException;
}
`
@Bean
public TestCommandGateway testCommandGateway(CommandBus commandBus) {
CommandGatewayFactory build = CommandGatewayFactory.builder().commandBus(commandBus).build();
return build.createGateway(TestCommandGateway.class);
}
At this point I am trying to get my exception back, since it contains more information about what went wrong, as a Map<String, Object> that I want to have in the response body.
From the CommandExecutionException/AxonServerRemoteCommandHandlingException objects only a description is available , which is not what I would like to return to the user.
As a note, I have read at some older post, that the exception thrown on the axon server is not transferred to the spring boot application, but I am not really sure if that is true.
Please let me know if I am doing something wrong, or if there is another way around this that I am not aware of.
Thank you in advance,
George Ginis