Articles → UIPATH → Try Catch Activity In Uipath
Try Catch Activity In Uipath
Purpose
- Try → Here, an exception-prone code will come
- Catch → Here, the action takes place (display or ignore exception) when an exception occurs
- Finally → This is the section that gets executed whether the exception occurs or does not occur
Example
- Drag and drop the "Try Catch" activity
- Inside the try block, drag, and drop the "Open Application" activity
- Inside the "Open Application" activity, open the Notepad application
Click to Enlarge
- To make it an error-prone activity, go to the selector of "Open Application" and make the application name "notepad1.exe" instead of "notepad.exe"
Click to Enlarge
- In the catch block, select the exception type
Click to Enlarge
- Drag and drop the "Message Box" inside the catches
Click to Enlarge
- In the finally section, drag and drop the "Message Box" activity
Click to Enlarge
- Save and run the bot
Output
Click to Enlarge