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.
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.