Skip to main content
Ground Control | Tier 1
July 31, 2024
Solved

throw activity

  • July 31, 2024
  • 2 replies
  • 148 views

Hi developers,

I am new to AA. I have a small doubt about throw activity. 

I am performing below steps:

Step1: Launch acme web application. https://acme-test.uipath.com/login

Step2: After launching application I want to check if it is a fresh login or already logged in.

           If it is already logged in, then I want to throw an exception and I want to click logout button and                 close the window. (here, I am capturing dashboard text and checking for availability                                   in https://acme-test.uipath.com/home and if text is available then I want to throw exception as                   “Already logged in”

Step3: Once logout and safe close is done, then i want to send an email and I want to exit from the flow and I don’t to want to perform the rest of logic 

Here, I have used try, catch and finally blocks

 

Attaching the logic and I am very much confused about what logic I have to kept inside the catch block.

Kindly clear my doubt and provide the best solution.

Thanks.

This topic has been closed for replies.
Best answer by JMarino

Hello @polugopi ,

The Finally section of an error catch ALWAYS executes no matter what happens (error or no error). So if you want that block to only execute under the conditions you have in the IF then place them under that IF and don’t worry about using the THROW action. If you want to stop execution of the BOT at that point you can use the Taskbot Stop action.

Another option is to use THROW and set a specific error message in the Throw command. This will pass that error message to the CATCH. In your catch, make sure you assign the error message to a variable.  Then (also in your CATCH) add an IF that checks for the specific error message and place the lines you want to execute inside that IF.

Hope this makes sense!

2 replies

JMarinoAnswer
Flight Specialist | Tier 4
August 16, 2024

Hello @polugopi ,

The Finally section of an error catch ALWAYS executes no matter what happens (error or no error). So if you want that block to only execute under the conditions you have in the IF then place them under that IF and don’t worry about using the THROW action. If you want to stop execution of the BOT at that point you can use the Taskbot Stop action.

Another option is to use THROW and set a specific error message in the Throw command. This will pass that error message to the CATCH. In your catch, make sure you assign the error message to a variable.  Then (also in your CATCH) add an IF that checks for the specific error message and place the lines you want to execute inside that IF.

Hope this makes sense!

CaptainPathfinder
Community AI Agent
July 16, 2025

That’s an interesting question, polugopi !

I think the following community members may be able to help 

@ChanduMohammad 

@Zaid Chougle 

@Tamil Arasu10 

@Paul Hawkins 

@Padmakumar 

I'm your friendly neighbourhood AI Agent! (it/they). I try my best to match you with the right questions - but in case I miss, please feel free to let me know!