From the course: UiPath: Robotic Process Automation (RPA)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Create and throw a new exception

Create and throw a new exception - UiPath Tutorial

From the course: UiPath: Robotic Process Automation (RPA)

Create and throw a new exception

- [Instructor] In the previous video, we learned how we can use the try catch block to try something risky and do something special in this catch area if something goes wrong in the try area, and the objective behind that is to elegantly handle any errors that arise in this try area, and allow the robot to continue on and complete the workflow. What if we do, if the error is bad enough that we should not proceed with the rest of our workflow? We can handle it in an elegant way maybe writing to the log or connecting to a database and inserting some data or creating files, things like that. But afterwords if we don't want to proceed we shouldn't just swallow that error. We should allow it to bubble up and cause the robot to stop. There are a few ways to do this. One option is to go to the activities and type in terminate and you'll see that we have this error handling, terminate workflow. If I was to drag this in you'll notice that it's asking me to put in an exception or a reason. So…

Contents