Description
Hey!
Before anything I would like express that this is a really great project, thank you very much for it!
We are using the Decide step to make a workflow follow one of two paths based on a condition, but in some cases that condition cannot be evaluated (invalid data or condition structure), therefore we want the Decide step to fail. The issue with making the Decide step fail while evaluating the condition is that the workflow status ends up being completed instead of terminated or suspended because the pointer has been already set as inactive by the moment we throw the exception (please see this line) and the DetermineNextExecutionTime method in WorkflowExecutor is setting the workflow status as completed because no step/pointer is active, sleeping or missing, so that's overwriting the already set error status in the workflow.
We are throwing the exception here, inside the custom method the Matches method is invoking.
We suggest changing
if (result.Proceed)
{
pointer.Active = false;
pointer.EndTime = _datetimeProvider.UtcNow;
pointer.Status = PointerStatus.Complete;
foreach (var outcomeTarget in step.Outcomes.Where(x => x.Matches(result, workflow.Data)))
{
workflow.ExecutionPointers.Add(_pointerFactory.BuildNextPointer(def, pointer, outcomeTarget));
}
to
if (result.Proceed)
{
foreach (var outcomeTarget in step.Outcomes.Where(x => x.Matches(result, workflow.Data)))
{
workflow.ExecutionPointers.Add(_pointerFactory.BuildNextPointer(def, pointer, outcomeTarget));
}
pointer.Active = false;
pointer.EndTime = _datetimeProvider.UtcNow;
pointer.Status = PointerStatus.Complete;
, but we are not 100% sure that will not affect anything else.
Please let us know if you need anything else about this or if it can be fixed/addressed differently.
Also, I could submit a pull request if you are okay with the suggestion and busy.