BusinessRuleException is not working

Hello Everyone,

In my project i have to throw some business rule exception after searching for a value, if it is not present in search results.

For this i am using new UiPath.Core.BusinessRuleException(Variable) to throw business rule exception. To capture this a BusinessRuleException is present in catch block. when this error occurred bot is moving to Generic Exception instead of BusinessRuleException though BusinessRuleException order comes before Generic Exception in catch block.

Please suggest me any idea how to resolve this issue.

Regards,
Vijay.

Hi @Vijay_Kumar_C,

Check the attached workflow here and let me know that you can get the idea. BusinessRuleException.xaml (7.0 KB)

For a detailed description on BusinessRuleException follow this link.

Regards,
Tharusha

Hey @Vijay_Kumar_C

In try block
While throwing Business Rule Exception you should give
new BusinessRuleException (“Your Reason”)

And in the catch block
Add a new catch with UiPath.Core.BusinessException

Thanks,
Goutham Vijay

Hey @Tharusha_Jayadeera

I did exactly how you did. but still the control is moving to generic exception only and not to business rule exception.

The link is for updating the status in Orchestrator and the ask is different.

Regards,
Vijay.

Hey @GouthamVijay

i did exactly the same way how you mentioned in the post. Still the control is moving to generic exception block only.

Regards,
Vijay.

Then there should be any other exceptional scenario before it hit the throw activity.
To find that, debug the flow with a break point in throw activity. Then check whether any other exception occurs before it hit the throw activity.

Regards,
Tharusha

Hi @Tharusha_Jayadeera

Thanks for reply.

But this is not the issue. I checked this in debug mode and it is executing the throw but control is moving to Generic Exception block.

Regards,
Vijay.

Hi @Vijay_Kumar_C,

Can you share a screenshot or the codebase if it is not confidential?

Regards,
Tharusha

@Vijay_Kumar_C

Check your conditions once like you have said business rule exception after searching for a value, there might be error in the activity. Please confirm that before.