Fail Workflow After Max Retries Help

Hi Folks,

I just recently started using Temporal IO as a state management tool and I have a question regarding Workflow failures. I managed to set up my code where ActivityFailures are caught properly, but when my max attempts for a failed activity are reached, the workflow terminates normally.

Is there any way to throw a TemporalFailure or ApplicationFailure to ensure that the Temporal UI displays Failed instead of Completed for the workflow? I have been trying to figure this out but no luck. If you have any examples on how to do this that would be great. Thank you!

You can throw ApplicationFailure from your workflow code:

throw ApplicationFailure.newFailure(...);
throw ApplicationFailure.newFailureWithCause(...);

to fail execution.

Great! That seems to have worked. Thanks for the help.