In this blog, we will be discussing UiPath Global Exception Handling in UiPath Studio. One essential component of automation is exception handling.

Unexpected problems can occur in every automation project and lead to the automation process failing. In this situation, it is used. It is a superb solution that makes handling exceptions in UiPath quick and easy.

What is UiPath Global Exception Handler

When an execution error occurs, the project’s behavior will be decided by a certain sort of workflow called the Global Exception Handler UiPath.

You may manage exceptions that arise throughout the automation process with the help of the UiPath Global Exception Handler tool. This offers a centralized method for handling exceptions and is connected with UiPath Studio. It allows you to catch exceptions, report them, and respond appropriately depending on the kind of exception.

This exception handler in UiPath has 2 arguments:

errorInfo (In Direction): It keeps records of the process that failed and the error which was thrown.

result (Out Direction): Whenever a process detects an error, it uses this information to decide how to proceed. You can assign or set the following values to this argument:

  • Abort: To stop the exception handling.
  • Ignore: Exception is ignored.
  • Retry: Retries the exception.
  • Continue: Continue the exception.
Exception Handling in UiPath Studio
Exception Handling in UiPath Studio

Importance of Exception Handling in Automation

In order to ensure that the automated process proceeds without hiccups, exception handling is essential.

It enters the picture and takes care of the exception if it arises. This enables businesses to continue automating processes without being interrupted, saving them time and effort.

Benefits of Using UiPath Global Exception Handler

Now check some of the benefits of using this on your automation process.

  • Streamlined Exception Handling
  • Improved Automation Process:
  • Better Insights into the Automation Process

Exception Handling Error during Debugging

Whenever an exception is found during debugging, the faulty activity is highlighted, so the execution has been stopped or paused, and the exception type and its specifics are described in the Call stack panels and locals.

There are several debugging options accessible in the ribbon, including Stop, Continue, Ignore, Slow Step, and Restart. Ignore is used to carry on with the following activity’s execution.

Retrying the current action without the Global Exception Handler UiPath is what the button does. The Continue action executes the Global Exception Handler UiPath while taking into account the result argument’s pre-selected values of Ignore, Abort, Continue, or Retry.

Global Exception Handler in UiPath Example

Now we provide an example to demonstrate its working in the automation process. You can use this demonstration to implement your project. You can follow below steps:

1. Create a Workflow

Our first step is to create a workflow to try this exception handler. To do this you can create your own workflow or you can follow the below steps and also refer to the below image.

  1. Open your UiPath Studio and create a new blank process.
  2. Create a new notepad file and save it. Here we are using “RPA Tutorials.txt” as the file name.
  3. Now search for Use Application/Browser Activity and add it to your workflow. Now indicate the notepad screen and give its file path.
  4. Now add the “Type into” activity into your workflow. This activity helps you to automatically type into the notepad with queries that you have provided.
  5. Now you have to save the notepad file which you have updated. To save, we use the “keyboard Shortcut” activity. In this set Ctrl + S saves the notepad file automatically.
  6. Now you have to close the notepad application. To do it you can use the “close application” activity and indicate the close icon on the notepad screen. This activity helps you to close the saved notepad file automatically.
UiPath Global Exception Handler Workflow
UiPath Global Exception Handler Workflow

2. Adding Global Exception Handler in UiPath

You have already ready with your workflow, now you have to add the exception handler to this workflow. To do this you can follow the below steps:

  1. Navigate to Design Tab -> New -> Global Handler.
  2. Give an appropriate name for the global handler and hit enter.
Global Exception Handler UiPath
Global Exception Handler UiPath
  1. Now, Return to the workflow you established earlier and make alterations so that one of the activities does not execute effectively. For example, within the “Use Application/Browser” activity, opt for the “Match exact title” option and verify that the file is closed prior to activating the “Run File” option located in the ribbon.

Upon encountering an exception, the Global Exception Handler initiates a process of retrying the impacted activity at least three times and records the name of which action failed. Should the same exception persist even after three retries, the execution will halt in the level of activity that raised the exception.

On the other hand, if no exception was detected during any of the retries, the workflow will proceed as normal, with the Global Exception Handler remaining inactive.”

Conclusion

We have looked at the methods for managing exceptions throughout our presentation, including by offering useful examples. You can also use this method in your own workflow. Here you will not need to use try catch if you use this exception handler.

Also check, UiPath

Faq on Global Exception Handler in UiPath

  1. What is a global exception handler in UiPath?

    The Global Exception Handler is a designated workflow in UiPath that is responsible for defining the behavior of the project when an execution error occurs.

  2. How many global exception handlers are there in UiPath?

    Only One Global Exception Handler can be used in a single project.

  3. How to create a global exception handler in UiPath?

    To create a global exception handler in UiPath, follow these steps: 1) Go to the Design tab, 2) select New, and 3) choose Global Exception. 4) Double-click on the Global Exception to add it automatically to your workflow.

Tagged in: