Throw faulted for Business rule exception

My throw activity set like this in child workflow of Process transaction

new BusinessRuleException(“Save error”). It is always getting treated as exception than Business exception in-spite of having catch block in Process transaction of RE framework.

You mean you do have a BusinessRuleException in your catch and it goes to Exception instead?

Yes,it is.

you may have some rethrow activity in the middle, you need to debug in catch to see the error type there.

I don’t have rethrow activity and throw is the last activity in my child workflow of process workflow which is part of process transaction.

Hello Rams,

The issue is likely that you have that error encapsulated in another Try/Catch that’s throwing a system exception.

I do have try catch block in my child work flow, but the throw is not part of that.

@Ramki81 - create a parent workflow and invoke the workflow that is actually doing all of this processing that you’re having trouble with. This will be a single sequence with a single ‘invoke workflow’ sequence. Then encapsulate that ‘invoke workflow’ with a try-catch. In the catch section, keep it as the generic exception type and put the following in a log message activity:

Log message: exception.GetType.ToString + " ; " + exception.source + " ; " + exception.message

If you do it exactly the way i described above, this will tell you the exception type that is thrown, which activity is throwing the final exception (to identify any extra throw or re-throw activities you didn’t realize), and will display the topmost exception message as well

Thanks Dave for detail steps to find out the source of the activity. I followed the same and found the source as my throw activity for exception.gettype as ‘Exception’ even though I have new BusinessRuleException(“Failed with exception”). Below is the log message of the same.

message": "System.Exception ; Throw Save error ; Failed with exception

Rename the activity that is throwing the business exception to something different. Call it something super unique. Then run it again and verify that the source is indeed that activity and not a different one

Yeah Dave, I did same. My throw activity has the unique name of ‘Throw Save error’ as shown in the previous post.

Hmmm, that is very strange. Try creating a simple try-catch with a throw activity in a different workflow to see if it is tracking the exception type properly?

You may also want to try another uipath specific exception type to see if that is working (perhaps activity timeout exception?) If nothing is working still, maybe try fully qualifying it - I think it’s uipath.core.businessruleexception but I’m not by a computer so not 100% sure

I added try catch block in the child workflow and all the processing logic is part of try block, now catch exception say it is business exception which is in same workflow. But this is not reaching the parent workflow which is very strange

It doesn’t matter what scope your Try/Catch activity resides, if it propagates up to a Try/Catch that switches the type, it’ll be switched.

Below is the only way that I am aware of that will do what you’re stating is happening. A Rethrow activity as stated by others would have kept the same error type.

Test_BusinessToSystemException.xaml (5.4 KB)