Continue after throw

Hello everyone, I am barely new in UIPATH Automation. I’m finding some difficulties in THROW EXCEPTION. I have an excel file that has 2 columns A and B. Column A contains numbers and some cells are null. Column B is the result field where I want to write success when there is a number found and Failed when a null is found. I managed to create this just fine, but also in the if where I check for is number: row.Item(0).ToString.IsNumeric in the else I want to write to the cell failed (which is working) and also to throw an exception. The problem is that the exception is thrown but then the process doesn’t continue, I am not able to go throw other rows I get stuck at the first occurrence of the NULL value. What I want to achieve is to throw an exception and the process to continue. How can I do this?

#uipath #throw #exception

The question is why would you like to throw the exception?

Cheers

Hi @CasseyEllsworth ,

I believe throw is not needed, just use if condition and log the message with the help of Logmessage activity.

But if you still want to throw then put your logic in trycatch block so that it will continue it’s execution.

Here you could learn about exception handling.

Cheers

What if I have a list of emails and I want to check if each email includes in its subject the word “Invoices”. For emails that don’t include this I want to throw an exception and continue to the next email

To achieve this

1 - Read all emails
2 - Iterate each emails from foreach loop or you can also use counters to achieve this
3 - Check in If condition as “mail.Subject.Contains(“Invoices”)” then go and do the task else do nothing.

There is no need to throw exception you can just log message here also.

Let me know if you have any doubt.

Yes but it is a requirement that I have to implement. So can I do that with a TRY Catch or throw?

Again it depends how your workflow is designed.

If you have parent try catch then just throw is enough.

Thank you very much!

I tried it with THROW but the process stops where it finds the email that doesn’t include the “Invoices” and it doesn’t iterate through other emails.

Because it wasn’t put inside try catch.
Use try catch.

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