Handling exceptions in Orchestrations
Following up from the last chapter where we dealt with developing Orchestrations, let's look at how to handle exceptions as they occur in Orchestrations.
Scopes
In the previous chapter, we looked at how we could use scopes to configure and use transactions, whether Long Running or Atomic. The other two major uses for the Scope shape are to handle exceptions and to trigger compensating logic. These two uses are in a way intertwined with the use of transactions.
A Scope shape configured with a Transaction Type of None or Long Running scope can have exception handling blocks added, but atomic scopes cannot. The rationale is that atomic scopes either complete, or they do not. If they do not, all state is reset to how it looked before the scope was initiated, and it is the initiator of the Atomic scope, usually a Long Running scope that should decide what action is to be performed.
A Scope shape configured as Atomic or Long Running can have Compensation blocks...