Try Catch in Reframework

Hello Team,
Hope you are doing good.I am building a process in Reframework and have below queries.
1: I am extracting data using datatable.I am using an IF condition to check if it is empty.
If it is empty i am using a trycatch block and sending an email.
But Problem is after the exception is caught it is not going to end state else it is going to “Get Transaction data” and then checking if there is any item in the Queue" .
As there is no item in the queue it is coming back to end state and in End state i have also send success email activity.
So 2 emails are send.
Can you please help

I want if no data found throw an exception and send email and end process and if data is present then execute the whole process and come to end state and send success email

Add Rethrow to the end of your catch block for the SQL statement. This will let the error continue properly through the REFramework.

I have removed the Try- Catch block and added Throw block and in the Run mode it is working fine.
It is going to the end process but problem is it is sending success mail which i have mentioned in the end process.
How can i send No data email and the bot should not send success mail.

Create an If activity in the End Process state to check if the system exception variable is Nothing. If it is Nothing, the process had no errors. Otherwise, there was an error, and you can set up your email to say so.

Note that this only works if you’re processing only one item. If you are processing multiple items, you may consider sending an email inside the Catch block of the Process state for each error. This wouldn’t stop the success email, however, so you can either send a generic report in the End State or create a variable which tracks whether or not any errors were found before sending the final email.


Thanks a lot Anthony.
I have declare an argument for the throw exception and i am passing it in the if block in end statement
But still it is sending success email and not other email mentioned in the else part.

The REFramework has a variable SystemException which will hold the error. Use this rather than your own predefined variable, as SystemException is updated whenever an application exception occurs in the framework.

Here the problem is i am getting an error which says “system exception is a type and cannot be used as an expression”
I am using the condition as SystemException Is Nothing

In the Throw activity i am mentioning exception as New SystemException(“No Data Found”)
In the End process i am getting the error.
Any suggestions

The If condition of SystemException Is Nothing should work, so I’m not sure why it’s throwing the error you’re getting.

I am also not sure why it is showing an error.

Hello Anthony,
Below is the error screenshot.

Can you also share the variable from the Variables panel? Curious to see the datatype or if anything about it has changed. View the variable while in End Process (want to also make sure that it is in scope).

Hello Anthony,
Please find attached variables screenshot.

Ah, I see. I think the variable has been changed in REFramework. Use SystemError Is Nothing instead.

1 Like

Hello Anthony,
It worked.Thanks a lot for the help

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