Try catch with invoke workflow file

Hello,
Do you know if there is a recommended way of using try catches while invoking workflow files? I have notices that if you create invoke withing another invoke you have to create a try catch for each of them so that an exception is not throw and the process continues. Is this correct? What are the rules of using try catches in processes with multiple invokes?

Hi,

I’m not an expert, but I find that the key of successful Error logging is to log the Source with exception.Source from the Invoke so you know which Activity it failed on, and is only possible with a Try/Catch surrounding an Invoke (Try/Catch surrounding your entire workflow sequence won’t work from my experience).

I’m not sure if interior Invokes will also return the exception.Source properly, so you might need to test this. If it doesn’t work correctly, then I would recommend surrounding the interior Invokes also, so you can store the Source followed by a Rethrow to back out to your main where you can perform a Clean workflow and retry.

If it is a workflow where you simply want to move on and not log any errors, then I think using a Try/Catch is useful as well unless it is only one action where a ContinueOnError might be considered.

Just my thoughts.

Regards.

2 Likes

Thank you Clayton