Try-Catch not working

No unfortunately I can’t share the XAML file as it has sensitive data. But I will see if I can replicate the workflow with sample data but it will take some time.

Thanks,
Ashok

Strange… Are your Try Catch statement inside of any another sequence ~ workflow? Perhaps your code are runnning but is not reaching try catch point due some error before

1 Like

No it is not under any other try-catch sequence.

Try- Catch works if there is only one activity within the try part. But when I add more than 1 activity try catch fails to capture the exception.

Thanks,
Ashok

Adding + @ClaytonM @loginerror

Guys, any solution for this situation?

Thanks,
Ashok

Could you please share your xaml file?

Tks

1 Like

Make sure the ContinueOnError is not set to True or it will not capture it.

Just show some screenshots of your activity or properties. You don’t need to attach your XAML or anything if you can’t do that.

Regards.

I just replicated the situation in following XAML file.

I have kept the the other files in this project folder to replicate what I use. Please run the process xaml file to test.

The message box accepts Int. When you provide string value as input it throws error. This error is handled in Try-Catch1 but fails in Try-Catch2.

Thanks,
Ashok

ScrapingBot.zip (502.1 KB)

1 Like

Thanks for your response @ClaytonM !

ContinueOnError is not set as true.

I have replicated the issue and uploaded the xaml file in my previous reply.

Ashok

Hello, first I’d like to point out that my question about sharing files was not with reference or mandatory ordering, being optional sharing (according to the forum rule that is very clear and accessible to everyone, in addition to what Clayton Claimed). This was only so that other contributors to the forum besides Clayton, could also have a clearer view of the need and help you, anyway I’m glad you understood =).

Second, I gave an edited and tested your Reframework XAML using the 2 try catch in Process and worked perfectly (assigns a log with the exception) and also created a BusinessRuleException only.

I’m attaching the last file I’ve tested ~ edited, take a look and see if the try catch are performed (enter strings in the input boxes)
ProcessCHANGEDKOTINDA.xaml (12.6 KB)

1 Like

Thanks the xaml file @Felipe_Kotinda! Can you please compress and upload the entire project as I sent you. As I previously mentioned If we copy the process.xaml file to a different folder and execute it is executing as expected but if we are executing it within the project then try catch stops working.

Thanks,
Ashok

Ohh sorry, follow attached here (I changed again the name to standard → Process)

If it’s still doesn’t work, tell me So I can try to figure out what’s going on

Check the output with logs after robot execution (I added a message for when bot reaches catches)

ScrapingBot.zip (502.4 KB)

Thank you!

It’s still not working. Please find the project attached. When try catch has more than 1 activity it fails.

image

Thanks,
Ashok

ScrapingBot.zip (502.4 KB)

:confused:

I tried again here (based the last file you sent me and the file attached here) and it works, I`ll check better and get back for you asap

ScrapingBot.zip (502.4 KB)

Please find the screenshot of the error message thrown!

Thanks,
Ashok

@ashoks93
I was able to isolate your problem to your project.json file.

  1. I took the .zip project file you posted, extracted, and then ran your Process.xaml.
  2. I confirmed that the Try Catch 2 was not catching the error when you input a string in the input dialog accepting an output of int32.
  3. I deleted your project.json file, and then reopened the project to generate a new, clean project.json file.
  4. I re-tried your Process.xaml
  5. This time, Try Catch 2 was catching the error.

So something’s up with your project.json file, dude. I couldn’t tell you what, though! Would need more testing and isolating within the scope of your project.

2 Likes

Hi @x.Rei.Ai.x,

Thnks for figuring that out. I just figured out that. We actually had “exceptionHandlerWorkflow”: in the project.json that was causing try-catch to fail. Once after removing that part I was able to fix the issue.

Thanks for all the input guys.

Ashok

2 Likes

@ashoks93
lol nice. I was just about to comment that after removing “exceptionHandlerWorkflow” from the .json file, the Process.xaml was catching the error again.

1 Like

A reason can be that u need to run the workflow from Main because (i believe) youre invoking the workflow only of that form the trycatch will work.

image

Bleess

Its project.json which caused the issue.

Thanks,
Ashok

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