Cannot catch Business Rule Exceptions thrown in subflows

Hi @Allan_Zimmermann

I noticed that Business Rule Exceptions thrown (using the throw business rule activity) in a Workflow that is invoked inside a try-catch activity cannot be caught as a OpenRPA.BusinessRuleException.

In my mind this must be a bug. If I throw it directly in the try-catch it is caught. When thrown in a subflow, it should propagate back to the calling flow (if not caught elsewhere), as if it had been thrown here.

I attached the example, but it is also very quick to reproduce from the description above.

Test Catch BusinessRuleException-Subflow.json (4.2 KB)
Test Catch BusinessRuleException.json (7.9 KB)

Kind regards,
Thomas

If the exception was not cought, openrpa woudl crach and then it was a bug.
The problem is you need to “unwrap” it, by recursively checking InnerException til you find it
Update Workitem does this for you and make sure to set the correct errortype on the woritem

I do not see why OpenRPA will crash if the “Invoke OpenRPA” activity returns a OpenRPA.BusinessRuleException instead of a System.Exception when an OpenRPA.BusinessRuleException has been thrown inside of a sub-workflow.

I have made a pull request to fix the issue I described in the small example. In my mind this is entirely similar to the change made for “Invoke Code”.

Kind regards,
Thomas

Sorry, not entirely similar to that issue, but the problem faced when throwing BusinessRuleExceptions inside “Invoke Code” was the same.

Not a bad idea … I like it … I will add that to next build

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