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.
@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:
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
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.
Be careful if you are working with a sequence call with the “isolated flag”.
It seems that if there is an exception subtype raised, it casts to “Exception” in the caller flow.