Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 10 Error Handling : Error Propagation

Error Propagation
Groups and called processes define the scope of an exception. An exception that occurs within a group or a called process causes processing to halt. Any unhandled exceptions are propagatged to the next highest exception scope. Unhandled errors occur where there is no error transition or Catch activity that specifies the activities to execute in the case of an error.
Also, you can use the Generate Error activity to create an unhandled error. The Generate Error activity does not permit any transitions to another activity, so any error created by the Generate Error activity is propagated to the next highest exception scope.
The following sections describe propagation of errors for groups and called processes.
Group Error Propagation
Unhandled errors halt the execution of a group and the error transition out of the group is taken. Figure 32 illustrates a process definition that waits for new text files, parses the files into an XML schema, then inserts the records into a database table.
Figure 32 Propagating errors from a group
The process definition uses two group activities. The first group is an iterate group that performs one update for each record. If any of the updates fail, an error transition out of the group is taken to the WriteLogEntry activity. A second group surrounds the iterate group to enclose all updates in a transaction. If the transaction succeeds, the process ends. If the transaction fails, the error transition is taken out of the transaction group to the SendMail activity.
The Generate Error activity is used to propagate an error outside of the transaction group to the next exception scope. If the iterate group experiences an error, the WriteLogEntry activity is executed, then the error transition out of the group is taken to the Send Mail activity.
The transition to the Send Mail activity is taken if there is either an error when committing the transaction or if the Generate Error activity is executed (because of an error in the iterate group). The error process variables contain the error information for the activity where the error occurred.
The Generate Error activity can use any error schemas defined on the process to propagate a specific schema to the parent process. See Process Error Schemas for more information about process error schemas.
Called Process Error Propagation
When a process definition calls another process definition, the called process can encounter errors. Any unhandled errors encountered when executing the called process cause the called process to halt execution and return the error to the next highest exception scope. Figure 33 illustrates a process definition that waits for an incoming HTTP request that contains an order.
Figure 33 Propagating errors from a called process
The GetCreditLimit process is called to check the credit limit of the customer that places the order. If the credit limit check succeeds, the ProcessOrder process is called. If the order processing is successful, a response is sent back to the customer stating the order is complete and the process definition terminates.
If the GetCreditLimit or ProcessOrder processes encounter an error, a response is sent back to the customer stating there was an error in the order and the process definition terminates.
The error process variables contain the error information for the activity where the error occurred. Also, a process can define an error schema and use the Generate Error activity to propagate specific data to the parent process. See Process Error Schemas for more information about process error schemas.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved