Guidelines for handling exceptions in your script

Exceptions are unexpected events that disrupt the normal control flow of your script. For example, trying to open an unexisting file or failing to open an application. Exceptions are also called errors.

Do not ignore exceptions

Do not ignore exceptions in your script. Whenever an exception occurs, log as much data you can to identify the reason for the exception. Ignoring exceptions can lead to unexpected bot behavior and hinder the maintenance process due to a lack of information.

Use the appropriate type of log message

Use the appropriate type of log message when using the Log message (logMessage) command. The following list describes each type available:

Use when logging process events.

Use when logging exception events that can do not stop the bot.

Use when logging unrecoverable exception events.

Capture the screen

If your bot automates a process by automating a graphical user interface (GUI), save a screen capture during the exception handling subroutine. The screen capture can evidence or help identify the reason for the error.

Emails in parameters

If your bot sends email messages with data about the exception, store the recipients' email accounts in a parameter in your IBM RPA Control Center environment. This enables you to change email accounts whenever necessary without changing the script.

Avoid sending technical log messages to end-users. To end-users, send clear messages signaling failures and, to interested parties, send technical messages.

Let the bot fail

If an exception handling subroutine does not handle the exception, that is, the subroutine is only responsible for recording data for analysis before stopping the running bot, do not end this subroutine with the Stop execution (stopExecution) command. Using this command will cause your bot to register that it ran successfully because this command is a command for exception handling in IBM RPA.