Problems passing arguments to parent workflow

I am trying to ensure arguments get passed from child workflow to parent workflow even when an exception is thrown in the child workflow. I am catching the exception in the child workflow and then rethrowing. However, rethrowing causes my arguments to NOT get passed up to parent. Any ideas on how to still pass arguments to parent?

Hello Demetrius,
I’m no expert, but I think a bespoke solution might help here.

  1. You make use of a variable to indicate whether your child process executed successfully or failed with some exception.
  2. Instead of rethrowing the exception, you update the variable and pass it back as norm.
  3. You can check the value of this variable in your parent workflow to take the necessary action.

This will allow you to always have access to the other arguments irrespective of the data state.

Hope this helps.

The issue with that solution is I need to be able to exit my child workflow in the event an exception occurs within it. In other words, if an exception happens in the child workflow, I don’t want to continue doing activities. I want to go back to the parent immediately. That is the reason why I rethrow. So I have doubts about your suggestion of not rethrowing the error. Hope that makes sense.

True, I missed that.
In that case, you can check the usage of the Terminate workflow activity and see if you achieve the desired result.

1 Like

Make sure if you don’t have one more try-catch above that throw…
It should work…and go back to parent flow…

if you want to pass your arguments back to parent even when exception is thrown, then you shouldnt rethrow.

Maybe you can add one more output argument in the child workflow called “out_exception”, if the child workflow has exception, then in the “catch” statement, set out_exception = exception.message, otherwise set out_exception = “”, and dont rethrow

Then in the main workflow check if out_Exception=blank or not . If its not blank then you know theres an exceptionn in child workflow

1 Like

But what if I need to exit the chid workflow immediately upon incurring an error. Then what?

use flowchart