Skip to main content

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.

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!


Reply