Business exceptions handling

hi guys

i would have to handle some business exceptions.when ever exception occurs bot has to log it then after it has to invoke another process file.
i am using this approach i am not sure whether it is best approach or not.
i am using Throw Activity in Try block then in the same block i am invoking the process file
Next in the catch block i am catching the exception with the below code
“uIpath.core.BusinessRuleException” in the same block i am using rethrow.
Can anyone guide is this better approach or not? if not let me know better approach to accomplish this task

Hello.

Just as a best practice, BusinessRuleExceptions should be used when something is wrong with the input and keeps the robot from processing an item. For exceptions related to application issues, I would recommend using normal Exceptions.

If it’s not an error that is occuring, like something wrong with your steps or input, then I would suggest not using the Throw activity and focus more on If or Decision activities for your logic.

So, I would need to know more about your process. However, I can say that if your intent is to capture a problem then do some logging and throw it again, your approach is correct, in my opinion. If you share more details, we can provide further guidance.

Regards.

3 Likes