Sub Service Node has a function to handle exception cases that occurred in the sub service. When the sub service throws an exception, you can design the main service to continue or stop in different ways. Here are some examples;
Main flow stops working and throwing an error from Sub Service
This case can be applied if you’d like the main flow to stop working when sub service falls into an exception case. ResponseCode and ResponseMessage will be thrown from the sub service.
Main flow continues working and throwing a different error from Sub Service
This is slightly different from the previous one. Instead of stopping and responding with an error thrown by the sub service, you can design your main flow to continue on other processes e.g. writing logs, and set a different error message throwing by the main service.
Main flow continues working and running in a loop
In case that the input parameters of sub service are a record of a datalist and require every record to run in a loop to complete the process, handling the exception of sub service will be different from the previous ones. The concept of exception line is it will carry over an error response code to the main flow. When the datalist is running in a loop, it will always carry over the error response code with it. This causes every process of sub service to fall into an exception case. To handle this case, the error response code must be reset to success before the process of sub service begins executing the next record.
To reset to success before the process of sub service begins for the next record, the following coding is required prior to Sub Service starts. Note that ResponseMessage can be changed.