Argument value is NULL/Empty when exiting invoke after a Throw activity was triggered

This has probably been discussed a couple of times before but what is the best practice for this scenario?

Framework: REF
Problem occurs after a throw activity is triggered inside an invoked flow inside of the process.xaml workflow.

My datatable with the direction set to “in/out” has no issues with this.
The issue arises when I use an argument with the type set to “string”, I would like to pass the value into the BRE transition and log it to a datatable but because it triggered a throw activity the value is set to “NULL” directly after exiting the invoked workflow. I tried to wrap the workflow with a Try Catch and pass the value in the Finally section before exiting the invoke but it does not seem to work.

What variable/argument type except “Datatable” works for this?
What is the best approach to output a value after a throw acitivity has been triggered?

I have read a couple of topics, like these ones:

These solutions/workarounds are a couple of years old.

I still use the second one, as it proves to be very reliable. It does requirea wee bit of overhead in maintaining all the excess error handling.
I believe, as a third option, the latest versions of UiPath support global variables as well, but I haven’t experimented with it yet. Using globals will present its own challenge of course, in that you need to be able to guarantee that at any time in your entire workflow, this global variable contains a reliable value.

It’s not very often I need to maintain a value all the way up to the error handler around the process.xaml in REF, so I’m very happy with option nr. 2

Anything that’s passed by reference would work.

@Jeroen_van_Loon @efelantti

Thank you for your answers.

I ended up using a dictionary. Initiliazing it in the Main.xaml workflow and passing it in/out from Process.xaml and then rethrowing/throwing the error. In my case I clear the dictionary for every transaction to make sure that an incorrect value does not get logged to the final datatable.