Module «Try/Catch»

This module allows you to handle errors that may occur during the execution of modules.

![Screenshot](img/TC_1.png)

Module consists of two blocks – TRY and CATCH. Block TRY contains a set of modules or the whole robot execution of which is needed, CATCH block contains a set of modules in case an error occurs in the execution of the modules of the TRY block.

The module has two text fields, the first is the “Note” field, into which you can enter a description of the module for more convenient navigation around the robot, and the second field is designed to save errors that occurred in the TRY module. Since it is possible to find out what error occurred, each possible error can be correctly processed in the CATCH block. ## EXAMPLE.

The task is to download a letter from the mail with a specific name of an attachment to a predetermined folder and process this attachment with the Excel module, and in the Excel module the path to the file will always be the same. For example the attachment is called «Daily report», path to the folder «C:\Reports», then this file will always be opened «C:\Reports\Report for the fay.xlsx», and attachments from the inbox will always be downloaded to the folder above.

If the email with the necessary attachment has not arrived yet, then the Excel module will generate an error “Could not open document C:\Reports\Report for the day.xlsx”.In this case, you need to somehow handle this error, prompt the user to start the robot later, or tell him to wait and try again.

To process the error with displaying the information window, you must add the «Try/Catch», where the TRY block will contain the email and Excel scanning modules, and the CATCH block the module Interface for displaying the user window.

![Screenshot](img/TC_2.png)

In result you will get this default message «The script worked successfully!» if the email was in inbox or with the «The email hasn't arrived yet» message if the email isn't there yet. The @error variable will contain the text «Could not open document C:\Reports\daily report for the day.xlsx».

![Screenshot](img/TC_3.png)