Try Catch Block for Multiple Sequences not executing while running the Process

Hello,

I have seen a few posts for Try-Catch block not executing for the program.

I am facing the same issue here. I have multiple set of sequences and everything is under a single try-catch block.

In case of an Exception, the Catch block does not execute while running the file from the Studio and from the Orchestrator as well.

I just get an error pop with the Exception.

Any thoughts?

Cheers
Nirav

@voranir

May I know what type of exception did you specified in Catch block ?

are you sure the exception used in catch block is System.Exception?

Yes, the exception used is System Exception.

Please find the screenshot below

While in Studio is the standard behavior that you first would get the Exception Popup and only go to your Catch after you choose Continue, but in Orchestrator you should always go to Catch if you are sure not to have any other Try Catch, or ContinueOnError=True, what makes you sure in orchestrator this is not working?

I have a section in the Catches section (the one that is commented in the screenshot above which has been uncommented in the package deployed to Orchestrator) which has Message Log activity which I cannot see it in Orchestrator logs.

image

So you are also sure there was an exception to be logged? Also it could be some failure in orchestrator log of the robot, do you see any other log there?

No, all I can see is this in the Job Details. The Logs shows nothing except execution start and end.

The process runs normally when without errors.

I am just introducing an exception by “Close Application” activity for Chrome with no Chrome open, and when I run only this as a separate test process, the Catches Block executes.

image

Ok, can you try introducing an error with something more simple? Like a Throw activity with New Exception(“this is my error”) as the first activity inside your Try sequence.

This did work in the Debug mode.

The thing that I can think of is that I have multiple sequences, so should it all contain separate Try Catch block which I don’t think should be the case?

If you intention is to wrap your entire application with one try catch, the better approach is the global exception handler sequence: #FeatureBlog - 18.4 - Global Exception Handler but im still unsure why it is not working for you the main try catch.

1 Like

Ok, I will try that… Thank you

1 Like

This does work except for the fact that I need to pass the arguments from the “Main.xaml” to the Exception Handler process. Is there anyway I can do this?

You mean having a custom IN argument to use in the global exception handler? besides the ones it already have? Im am not sure if you could access that from main.xml to be honest… @Lahiru.Fernando Do you know if it is possible?

1 Like

Hey guys,

according to my knowledge, Global exception handler cannot access the data in in other xaml files including the main.xaml. Additionally, i don’t think we can pass any additional arguments to global exception handler as we do not know from where it will be invoked. And this invoke, does not happen through invoke workflow activity. It happens at project level in case of an error.

So, if you want to capture data in other workflows, the ideal would be to use a Try Catch in those workflows to handle it in the workflow itself. I went through the posts above, and I was wondering why the catch segment is not getting executed in your workflow… :thinking:

Apart from this workflow, have you just tried creating another test workflow, including some activities that will throw an error in the catch segment and see whether it executes the catch segment?

2 Likes

Yes, it is strange.

Just one thing I noticed is that I have given Continue on Error = ‘True’ on some of the activities.

Does that affect the try block even if that’s not where the exception has occurred?

only if you set it on activitties that are containers, then all child activities will not throw errors as well…

Guys, I just re did the whole process and it works now…

I believe it was something to do with the sequences!!!

Thanks for all your help

Cheers!!

2 Likes

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