We have a flow where if some actions are not done by a certain time period, we want to fail the workflow, to use alarming mechanisms.
For failing the workflow, I was initially thinking of just returning an exception from the code. But after reading sources online, it seems like the exception in decider flow will not let the host return the result and some other host will just pick the pending decision task after some time.
Wanted to know if there's a programmatic way to terminate the workflow in between via workflow code and marking the SWF workflow execution as failed.
To fail a workflow using the Flow Framework throw an Exception or its subclass from the workflow code.
Don't throw an Error from the workflow code. This indeed is going to fail a decision task which will lead to the workflow getting blocked in a retry loop.