Exception on compensation

By default, workflows get blocked instead of failing on any exceptions that don’t extend TemporalException. This is done to avoid failing long-running workflows on unexpected bugs/failures. This gives the chance for fixing the bug without dealing with potentially millions of failed workflows.

If you want the workflow to fail on Saga$CompensationException you have two options.

The first one is to catch this exception and rethrow it as ApplicationFailure (which always fails a workflow).

The second one is two add the Saga$CompensationException to the list of exceptions that fail the workflow. This list is specified through the WorkflowImplementationOptions.

2 Likes