ReFrameWork - Throw BusinessRuleException

Hi,

I was wondering how to properly throw a business exception in the reframework model.
I have the following structure Main<process<List of actions to do. In my list of actions to do, i invoke a workflow (called “Validate Data”) where I validate data nomenclature. In this workflow, I throw an exception using the activity “Throw”, with the input : new BusinessRuleException(“Message”).

It is okay if we use the “Throw” activity, or should we use an assign activity?
We have a try catch in the process xaml AND the main xaml. If we catch a business exception in the process xaml, should I use the “Rethrow” activity or can I use the throw activity again?

Lastly, when should we use a “Throw” activity VS “Assign” activity when we regarding throwing/handling exceptions?

Thanks!
Ben

1 Like

Ideally, only the Main would be surrounded by a Try/Catch to handle exceptions that come in from the other workflows that are invoked. BusinessRuleExceptions should be used for exceptions that you do not want to retry the process, such as input errors, expired/invalid passwords, you know stuff that can’t be resolved by doing the process over again.

I would suggest storing the Message for the BusinessRuleException you plan to throw into a variable (usually in the Config.xlsx file), and yeah you are correct in using new BusinessRuleException(message). I don’t get what you mean by using an Assign, unless you mean to assign SystemError = exception. In my opinion, you should just throw the exception you want to throw in your workflow(s) and let the Main’s exception handling pick it up.

If you do surround the Process.xaml or other workflows with a Try/Catch, then you would want a Rethrow to be used. But, only surround it with a Try/Catch if there are other actions you want to take place before it moves to error handling in the Main.

Hopefully, I described that clearly. :grin:

Regards.

4 Likes

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