Easy way to IT Job

Error Handling in UiPath
Share on your Social Media

Error Handling in UiPath

Published On: September 15, 2022

Error Handling in UiPath

One of the most widely used RPA solutions for Windows desktop automation is UiPath.

It offers drag-and-drop capabilities for actions and it is utilized to automate repetitive processes without human interaction.

We will go through all the fundamentals of how to manage problems in projects in this Blog post on “Error Handling in UiPath.

You need to grasp two basic concepts when it comes to Error Handling in UiPath:

Following your reading of the aforementioned two subjects, we’ll go over a few pointers and advice that will help you recognize some typical mistakes and teach you how to prevent them.

Reshape your fundamental skills with our UiPath Training in Chennai at Softlogic Systems.

Debugging

Simply said, debugging is the process of finding and fixing faults in the project. Now you must choose the Execute tab to debug issues. As you can see in the figure below, the Execute tab is divided into three sections: Launch, Debug, and Logs.

Debugging

Let us go through each section’s functions one at a time.

Launch Section

The launch section has the following three options

Launch Section

The Run option is utilized when you just want to run your project, as you can see in the accompanying image.

As a result, if you choose this option, you would not witness the step-by-step execution but rather the output.

The project execution may be stopped in the middle of it using the Stop button, and faults can be step-by-step debugged with the Debug button.

Debug Section

The debug section has the following five options

Debug Section

Steps : Your project will be carried out in steps. So, after executing the next step when you click Step Into, it waits.

Validate : This button is used to validate your project and determine whether or not it has any mistakes.

As a result, if you select this option, UiPath will determine whether your automation has any problems and deliver the error to you.

Breakpoints : These are the points in an execution where you wish to halt it and begin a methodical debugging process. Two possibilities are presented by the breakpoints button:

  • Toggle Breakpoints
  • Remove All Breakpoints

Slow Step : Your execution will be slowed down by Slow Step so that you can keep track of what is going on.

Options : They offer a variety of highlighting choices to draw attention to the activities.

For highlighting any action while you are debugging your project, you may utilize this.

Logs Section

There is only one option in Logs Section known as Open Logs. They allow you to debug the program using the logs and they can be verified where your values went wrong from the logs.

Logs Section

Exception Handling

The principal aim of exception handling is addressing errors related to various UiPath tasks. The Error Handling activity provides the following four options: Rethrow, Terminate Workflow, Throw, and Try Catch.

Exception Handling

Rethrow : When you want events to take place before the exception is thrown, you use rethrow.

Terminate Workflow : When a task meets an error, the workflow can be stopped using the Terminate Workflow command.

Throw : When you intend to throw an error before the step is executed, use the throw activity.

Try Catch : When you need to test anything and handle the exception appropriately, you use a catch action.

Therefore, you can test anything by placing it in the try part, and if an error happens, it can be addressed using the catch section based on the input you provide to the catch section.

How to Perform Exception Handling in UiPath?

Consider the following example to understand how to perform exception handling in UiPath

Step 1 : Create a new process with the name of Exception_Handling_Sample

How To Perform Exception Handling In Uipath

Step 2 : Add Open Browser Activity inside the sequence once the Excelption_Handling_Sample process is in the UiPath Studio and enter the google URL (www.google.com) as follows.

Browser Activity

Step 3 : Then, add a Type Into action to the sequence’s DO Container, click on the browser’s Indicate element button, and then choose the Google search box (Ensure that the browser has opened).

Put the text you wish to search for in the Google search box after that.

 

Google Search Box

Step 4 : Click on the three horizontal lines from the Type Into Activity pane to select the Edit Selector option

Edit Selector Option

Step 5 : Update the name of the Edit Selector Wizard from ‘q’ to ‘z’ and click ok. As it is already named q, now it will send an exception.

Edit Selector Wizard+

Edit Attributes

Step 6 : We will learn how the exception occurs and then how to handle it by developing an error scenario. An InvalidUiElementException will be thrown if you save and execute the sequence.

Execute The Sequence

In our production, we have to deal with instances that are extremely si
milar to this one when run-time exceptions occur. Try Catch Block can be used to handle these exceptions.

Step 7 : Move the Type Into activity within the Try block and insert the Try Catch action inside the sequence. then choose the kind of exception you are experiencing. If the exception type you are seeing is not shown, click on the Browser for Types… link and look it up.

Try Catch Action

Step 8 : Click on the Browser for types and search for InvalidUiElementExeception and click ok.

Invalid Ui Element Exeception

Step 9 : Now do the following

  • Go to the Exception Block and Add Log Message Activity
  • Set Log Level to Error
  • Now, Enter the message as Not Found Element as follows

 

Exception Block

Step 10 : Now, the error message will be shown on the output screen when we execute the sequence.

Error Message

As a result, anytime a Try block error occurs, the execution will move to the catch block and a Not Found Element message will be shown on the Output pane rather than being aborted.

Step 11 : If you want to run code regardless if an error happens or even if there isn’t one, put it in the Finally block.

Add the Close tab action to the Finally block so that it will be executed whether or not the error occurs.

Finally Block

Conclusion

We hope this Blog helps you with the understanding of exception handling in UiPath. Accelerate your career by learning in our UiPath Training Institute in Chennai.

Share on your Social Media

Just a minute!

If you have any questions that you did not find answers for, our counsellors are here to answer them. You can get all your queries answered before deciding to join SLA and move your career forward.

We are excited to get started with you

Give us your information and we will arange for a free call (at your convenience) with one of our counsellors. You can get all your queries answered before deciding to join SLA and move your career forward.