Error Handling Sequence if any error caused from another sequence

Dear friends,

I have an automation script for Google Chrome that performs various activities such as clicking, typing, and managing VPN connections. While the script generally works smoothly, sometimes delays in website responses can cause errors and stop the automation.

I want to implement an Error Handling sequence that will be processed if any issues encountered during the automation process from above sequence. This error handling sequence will include steps like turning off VPN and logging out of accounts then go back first step for above sequence.

Could someone please guide me on where I can learn to create such an error handling sequence? Is this approach feasible?

Thank you in advance for your help!

Hi @Nam_Hoang ,

Creating an error-handling sequence in UiPath is a practical approach to manage exceptions and ensure that your automation script can recover from errors and continue executing. Here’s a step-by-step guide to help you implement this:

Step-by-Step Guide to Implement Error Handling in UiPath

  1. Wrap your main sequence in a Try-Catch block:
  • This allows you to catch exceptions and handle them gracefully.
  1. Implement the Error Handling Sequence:
  • In the Catch block, define the steps to handle errors, such as turning off VPN and logging out of accounts.
  1. Loop back to the first step:
  • Ensure that after handling the error, the script can return to the initial step of your main sequence.

Detailed Implementation

  1. Create the Main Sequence:
  • Design your automation script with activities like clicking, typing, and managing VPN connections.
  1. Wrap Main Sequence in a Try-Catch Block:
  • Use the Try Catch activity to wrap your main sequence.
  1. Define Error Handling Sequence:
  • In the Catch block, define the activities to be performed in case of an error.
  1. Loop Back Mechanism:
  • Use a loop to ensure the script starts over after handling the error.

Implementing Specific Steps

  1. Turning Off VPN:
  • Use the Invoke Code activity to run scripts or commands that turn off the VPN.
  1. Logging Out of Accounts:
  • Use the Click and other relevant activities to log out of accounts.
  1. Loop Back to the First Step:
  • You can use the Invoke Workflow File activity to call the main sequence again, creating a loop.

Regards
Sandy

1 Like

Thank you so much @sandyarpa767

I dont know how to set up that:

If any issues (anything that stop the automation) occur during the first sequence, go to the error handling sequence. This includes turning off and logging out, then restarting the first sequence from the beginning.

thank you so much

Hi ,

lets assume we have error in our main sequence and surrounded by try catch block ,

now in catch block we know that if error happened what steps needs to be done .

for example :-

i am trying to read the excel file

but excel file is open

i have surrounded the excel file read activity with try catch block

and in catch block i will try to close the excel / kill the excel process .

Hope u have got some idea .

Regards
Sandy

1 Like

Thank you so much @sandyarpa767

My main sequence involves around 70 activities, including:

  1. Opening an Excel file.
  2. Looping through each row.
  3. Opening a browser.
  4. Choosing a VPN.
  5. Logging into an account.
  6. Posting text to a website.
  7. Saving data.
  8. Getting text from the web to the current row in Excel.
  9. Logging out of the account.
  10. Disconnecting the VPN.
  11. Moving to the next row in Excel.

Errors can occur at any step due to web delays. If an error happens at any point in the main sequence, I want to:

  1. Go to the error handling sequence.
  2. Disconnect the VPN and log out of the account.
  3. Close the web browser.
  4. Mark the current Excel row as “FAIL.”
  5. Loop to the next row in Excel and continue with the main sequence.
  6. Disconnect the VPN and log out of the account.
  7. Close the web browser.
  8. Mark the current Excel row as “FAIL.”
  9. Loop to the next row in Excel and continue with the main sequence.

I hope my explanation is clear so that you can advise me some solution. Thank you in advance.