Try catch not catching and restart the workflow

I have a workflow that works like this: I have to enter a number in a text box, and then click “Next.” This opens a new screen. The problem is that sometimes the value I enter is not a number, so the web page doesn’t accept it and I can’t proceed to the next page. Therefore, when the next activity tries to take the new page, it throws an error because it can’t find it. My idea is to put the workflow inside a TRY … CATCH statement, so that when it can’t find this page, I can handle the error, i.e., close the page that is currently open and proceed to the next record.

The problem is that it doesn’t enter the TRY CATCH statement, and in addition, the entire workflow is restarted, resulting in an infinite loop. This is because it makes 3 or 4 records and falls into one that breaks the flow and restarts.

here when the errors ocurrs



before the error

Hello

Can you not validate the value you are entering is a number first? This would be before you try to enter it into the website.

Put this into an IF activity to validate your text:
System.text.regularexpressions.regex.IsMatch(yourStr, “\D+”)

Then:
Insert Throw - yourStr is not a number.

Else:
Continue.

Cheers

Steve

HI,

Is the matter in debug mode? If so, can you try just Run or turn on ContinueOnException button in Ribbon menu?

And also, can you check if you use global exception handler?

Regards,

I could do it, but the try-catch block is there for a reason, and that is so that if any problems occur, I can handle them correctly.

Regards

Sure keep it but you can eliminate this problem in a more controlled manner.

For some reason, if I run it WITHOUT debugging, it apparently works, which is a quite annoying symptom since debugging is essential.
I didn’t know about the global handler option, I’ll investigate it.

HI,

How about to turn on ContinueOnException on ribbon menu?

Regards,

tried doing that, but it didn’t work, meaning the process restarted entirely. For example, the data comes from a spreadsheet, the first error occurred in register 5, then after the exception occurred, it started over from 0. It literally started over from the beginning, I put a log message at the beginning to check it.

regards

Well, after running in “normal” mode with the “run” button, everything started working fine. Magically the debug was fixed

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