There are various ways to capture the exception, and yours looks good. Just make sure you are capturing the .Source if it isn’t already because that will tell you the activity that failed (note: always rename your activities to something unique)
To the thread title specifically, getting an argument back from a workflow that failed is only possible if you surround the workflow with the Try/Catch, store the exception to another argument, and ensure that no exception is thrown. When the exception is thrown, all arguments are not returned. loginerror presented a good way to do this, however using the Rethrow will throw the exception so the arguments won’t be returned, from my understanding (I could be wrong).
Now typically, you want to do exception capture in the framework so you are not coding in repetitive actions and performing the same exception actions on all portions of the process. But, in the case where you want the argument to be returned, you would want the workflow to not throw an exception, which means you need to surround it by a Try/Catch, capture the exception either with assign and/or log message. Then, the arguments will return to the framework, and you would use the Throw activity with the stored exception in the framework in order to show an error occurred.
I don’t usually surround the workflows with a Try/Catch though (I did earlier in my UiPath adventure), because my goal is for the framework to handle all exceptions.
I hope this bit of information is helpful
In summary, to return the arguments you will do something like this:
---REFramework, Try/Catch around Process Flowchart, Invoke Workflows
---Surround workflows that you need to return arguments with a Try/Catch
------In Catch, store exception to either an exception type variable or to a string including the exception.Source and .Message... don't Rethrow error here
---After Invoke in REFramework, check if there was an exception, and throw exception
------In catch, do all exception actions like Log Message somewhere, take screenshot, et cetera