Error handling in A360

Error Handling in A360 – Try, Catch & Finally Actions

In this post, we will be learning to implement Error Handling in A360 using the Error Handler package.

Error Handling

As the name suggests, the process of handling unexpected or runtime errors in the bot or code is known as error handling. In Automation 360, the error handling is implemented using the error handler package.

Error Handler Package

The Error handler package contains actions that enable you to easily handle exceptions a bot encounters and transfers control to the other actions within that bot.

Why do we need Error Handling?

We need error handling so that the bot is not terminated abruptly in case of any runtime errors or exceptions. So to ensure smooth bot execution, we need to implement an error handling mechanism.

Error handling also helps us to achieve stability in our code.

Error Handling in A360

Now, we know that what is error handling and why do we need error handling in our project/bot. We will be looking at implementing error handling in A360 with help of an example bot.

Error Handling in A360 with example

In this example, we are calculating the percentage of the marks obtained out of 80. Here, we have purposefully induced an error at line number 4.

When we run this bot it will give us a Divide by Zero error at line number 4 and the message box from the Catch action will be displayed.

For Catch action, we have configured 2 variables – errorMessage, errorLineNumber as shown below:

Error Handling in A360

Bot Execution Flow:

  • If there is an error in the Try action, the control is transferred to Catch action and then to Finally action.
  • When there is no error in the Try block, the control is transferred to Finally action.

Error Handler Actions

There are 4 actions available in the Error handler package of the Automation Anywhere Automation 360 (A360) platform.

Try

In this block, we write our code that we think is error-prone. We need to include the logic that we feel might cause runtime errors or any other exceptions. As a best practice, we can include your business logic inside a Try action.

If the bot does not encounter any errors, execution continues to the Finally action if it exists.

Catch

The Catch action helps us to catch the exception and take appropriate action.

When there is an exception in Try block, the control is transferred to the Catch block. For instance, in the Catch block, we can log the error message, error line number, and so on.

In case of an error, if we want to send an email to the concerned team, we can do that in the Catch action.

Finally

The Finally action enables us to execute actions after Try and Catch, regardless of whether an exception occurs or not. This is the best place to do cleanup operations like closing opened connections for excel, database or SAP, etc.

Also, we can use this action to perform audit logs. The Finally action is optional. It’s not mandatory to use it along with Try and Catch actions.

Throw

If a logical error occurs within a Try action, you can use the Throw action to create an error condition, which will immediately shift the bot execution to the Catch action. We can set the custom error message using the Throw action.

If we use Throw action outside of Try action then a standard error dialog box is displayed that needs to be closed manually.

Error Handling in A360 Video

In case you prefer a video format to learn concepts, you may refer to our Error Handling in A360 video on our youtube channel. Also, please consider subscribing to the channel.


Design, develop and deploy software bots with RPA. Build an intelligent digital workforce using RPA, cognitive automation, and analytics. Automate business processes using Automation Anywhere products.

Offered By: Automation Anywhere


Further Reading

If you would like to explore more on the Error Handling mechanism, kindly refer to the official documentation of Automation Anywhere.

Hope you like this post. Please share it with your colleagues, friends, and aspiring Automation Anywhere RPA Developers.

If you want to explore our other posts on A360 then check this link – Automation 360 (A360)

Happy Automation!

Share with your friends:

Leave a Reply

Scroll to Top