Killing a process if a job failed



So this is what i want: When I run a job and it fails, I want to kill the program on which I run the script and I want to see on Orchestrator that the job failed. I tried to run a .bat file that kills my process after my sequence is done ( at all moments i checked ContinueOnError to True and it kills my process but on Orchestrator I see that the job is complete and I don’t want this, I want to see that the job failed and I want to see why).


Job is Faulted if there is an uncaught exception. Simplest way is to add a Throw at the end of your failed branch.

Other thing would be to get rid of the ContinueOnError and add a top level Try-Catch with rethrow, or a Try-Finally with closing the app in Finally.


Thank you Andrzej Kniola,

But will this throw let me know the step on which my job / test case failed? Is there any way to know, after the run, where my job / test case failed?


To get the exception source take a look at this.
It is possible though not in main workflow.


You should get rid of the ContinueOnError if you want to know which step failed (or TBH, get rid of them either way), because they’re essentially hiding failures.
They’re useful only in certain occassions and need to be handled with care - carpet-bombing the workflow with them is a sure way to making debugging a real pain.
An example of a proper use of ContinueOnError might be with:

UiElement myElement = FindElement(someSelector, ContinueOnError = True)
if (myElement is Nothing)
Then RefreshPageAndTryAgain
Else DoSomethingWithIt

It’s an alternative to using ElementExists -> If yes -> FindElement.


I tried with Try Catch, now I can close the app if an error occurs on my sequence but on Orchestrator it shows that my job is successful (I can see the error only if I go on my robot logs) . I want to see on Orchestrator that an error(and what error) made sequence to stop.