I have an Orchestrator Function
(Isolated Worker for .NET 7
web application) which calls multiple Activity Functions
. Each of those Activity Functions
has their own try/catch block in their respective method bodies. So, if an exception is thrown in an Activity Function or in the Orchestrator Function, they all have their own try/catch block, so the exception is handled. According to the bottom of this documentation:
"If an orchestrator function fails with an unhandled exception, the details of the exception are logged and the instance completes with a Failed status."
Because this Function is triggered by users (internal to our company) and could take 1-2+ hours, I want to have the status updated on an exception which users can do by clicking a button (I have a separate question about asynchronously updating UI from Orchestrator Function
if anyone has knowledge of appropriate approach, but that's a separate topic.
So, is it a good idea to just add "Throw" after each exception is handled, including the Orchestrator Function, so the function fails and the status is updated or is that a bad approach/not the best approach?
Rethrowing an exception is common practice, reference document.
I am rethrowing exception in the activity function to get the error in activity function.
My durable function code:
Output: