I’m trying to set up an app with axon server as an event store. I have an aggregate that is accessible via Spring MVC Controller with REST endpoints. I have a problem with handling a situation when an ID provided in my REST resource endpoint does not exists as an aggregate.
I would like to return 404 code from a spring in @ExceptionHandler but it looks like that I’m only able to catch CommandExecutionException that can correspond to any axon related issues.
What I see is that I receive a proper message from axon however its a response from axon server wrapped by some general Exception. Is there a clean way how i can determine that the cause of axon failure was f.g. AggregateNotFoundException?