Throw an exception by purpouse

I need to give an error on purpose when a specific element appears on the screen, when some screen appears, I know I need to use trycatch and get element to catch the element, but I want to return something like “Error by XPTO” and an error stopping the workflow.

How can I handle that?

You can use throw and use new system.exception or just use businessruleexception to use a string value

If you only need to throw an error IF a specific element occurs, then you do not need a try catch.
You can just use a get element with MinResults = 0 and MaxResults = 1. Then put some throw exception activity (options listed by Allan) inside the body of the Get Element activity. It will only be run if the element is found.

Of course you need to be sure you are not catching that exception somewhere else. If you need to have an outer try-catch but need this specific place to stop execution anyways, then use the TerminateWorkflow or Stop OpenRPA activity.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.