Articles → UIPATH → Throw Activity In Uipath

Throw Activity In Uipath






Purpose







Implementation




  1. Drag and drop the "try-catch" activity in UiPath
  2. In the try block
    1. Get the file name in the "FileName" variable
    2. Check if the file name starts with the word "gyan" using the "if" activity
    3. If the file name starts with the word "gyan" then read the text file using the "Read Text File" activity
    4. Else throw an exception using the "throw" activity
    5. Picture showing the try-catch block with throw activity inside the try block
      Click to Enlarge
  3. In the catch block
    1. Select the exception type as "System.Exception"
    2. Show the exception using the message box
    3. Picture showing the catch block to catch the exception raised by throw activity in try block
      Click to Enlarge
  4. Save and run the bot

Output


Picture showing the message box to display the exception message
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, March 15, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250