Skip to content

Commit

Permalink
GitBook: [master] one page modified
Browse files Browse the repository at this point in the history
  • Loading branch information
domaincomponents authored and gitbook-bot committed Apr 18, 2020
1 parent 386701b commit 29dcb31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions axon-framework/axon-framework-commands/exception-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Exception handling is a well known concept when developing software. Dealing wit

## Handler Execution Exception

The `HandlerExecutionException` marks an exception which originates from a message handling member. Since an[ Event]() message is unidirectional, handling an event does not include any return values. As such, the `HandlerExecutionException` should only be returned as an exceptional result from handling a command. Axon provides a more concrete implementation of this exception for failed command and query handling, respectively the `CommandExecutionException` and `QueryExecutionException`.
The `HandlerExecutionException` marks an exception which originates from a message handling member. Since an [Event](../events/) message is unidirectional, handling an event does not include any return values. As such, the `HandlerExecutionException` should only be returned as an exceptional result from handling a command. Axon provides a more concrete implementation of this exception for failed command and query handling, respectively the `CommandExecutionException` and `QueryExecutionException`.

The usefulness of a dedicated handler execution exception becomes clearer in a distributed application environment where, for example, there is a dedicated application for dealing with commands and another application tasked with the query side. Due to the application segregation, you loose any certainty that both applications can access the same classes, which thus holds for any exception classes. To support and encourage this decoupling, Axon will generify any exception which is a result of Command or Query Handling

To maintain support for conditional logic dependent on the type of exception thrown in a distributed scenario, it is possible to provide details in a `HandlerExecutionException`. It is thus recommended to throw a `CommandExecutionException` / `QueryExecutionException`with the required details, when command/query handling fails. This behaviour could be supported generically by implementing [interceptors]() which perform exception wrapping for you.
To maintain support for conditional logic dependent on the type of exception thrown in a distributed scenario, it is possible to provide details in a `HandlerExecutionException`. It is thus recommended to throw a `CommandExecutionException` / `QueryExecutionException`with the required details, when command/query handling fails. This behaviour could be supported generically by implementing [interceptors](../messaging-concepts/message-intercepting.md) which perform exception wrapping for you.

0 comments on commit 29dcb31

Please sign in to comment.