We can add the Try-Catch block and log any errors by following these steps:
- Let's add the Error Handler Try Action at the beginning of the code as shown below. Move the steps we have completed so far into the Try block. Just drag the first Step Action into the Try block; all the steps will move into the Try block.
- Next, we'll add the Error Handler Catch block at the end. In the Catch properties, set the Exception type to AllErrors. Create a String variable called errorMesage to store the error message.
- Within this Catch block, let's log errors. To do this, add a Log to file Action with a message stating $System:Machine$ - ERROR - Bot failed with exception: $errorMessage$.
Your overall configuration for the Parent bot, including exception handling, will look as follows:
Now that we have finished configuring the Parent and Child bots, let's test them.