How to stop execution of the program, but without Exception message?

I want my robot to stop executing further once a condition doesn’t meet a requirement.
I am not talking about leaving a specific workflow or xmal file. I am talking about actually stopping the further execution of the program.

I was using Terminate Workflow activity, but it gives an ugly Exception message. I wanted to hide it, so I followed this:

Sure, it won’t display exception messages with the above method, but this is not stopping the execution… First of all, this method does NOT even execute Terminate Workflow activity. I debugged the above program, but at Throw activity right above the Terminate workflow, the program stops.
How can I stop the execution of the program itself?

I have like 10 .xmal files in order, and if a problem happens at, say, the second .xmal in the flow, I don’t want the program to proceed to the third. I want the program to completely stop the execution there WITHOUT Exception message. Like exiting the program completely.

You can structure the whole process as a flowchart instead of a sequence. After each workflow check to see if that workflow completed successfully. If it did go to the next workflow. If it did not then do nothing and the robot will stop.

1 Like

Hi @tomato25,

Is there any particular reason you try to hide away the errors ? To keep your workflow maintainable you should properly log the problems and handle exceptions.

You can use global error handler to finish the process on any error but I’d be very cautious with hiding the error log as it may come useful in debugging :slight_smile:

Best regards,
Filip

1 Like

Hmmm, I already have all the sequences…
I am using ReFramework, and all of my sequences are in Process.xmal sequence.

How could I re-structure all this into flowchart???

I am actually not trying to hide the errors. I do show the error in Message Box.
I just don’t want Exception message to be shown to my client, and all the error details. I am including an error code only I can understand in the Message Box. I am also keeping the log as well.

I just want to terminate the execution with a nice message, but not Exception message.

@tomato25,

That should do the trick (with abort result):

Best Regards,
Filip

2 Likes

Hello, You can use Should Stop activity. Checks if somebody stopped a running job using the Stop option in UiPath Orchestrator. This activity assures a smooth termination of a job since it prevents the sudden interruption of an ongoing process.
Let’s assume we have a workflow which extracts items from a queue and uses the Write Range activity to insert them in an Excel file. The Should Stop activity can be added after the Write Range activity. This would mean that even if the job is stopped in Orchestrator, currently processed information is still written to the Excel file. You can use the Result of the Should Stop activity as a condition for an If activity, as follows:

  • Then - Use a Message Box or Send Mail Message activity to inform users that the job was stopped in Orchestrator if the value of the Result property is True .
  • Else - Leave this field blank so that the workflow continues normally if the value of the Result property is False .
2 Likes

Unfortunately I am not using Orchestrator…

Using Throw activity you can create your own customized exception. Watch this video from 46.00.

1 Like

Are you using terminate activity in catch? If not try that.

2 Likes

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