Skip to main content

Handle errors in a group of steps

The Try / Catch node (Flow & Logic) protects a group of steps with one error handler. When any step in the group fails, the run does not fail. The node runs your fallback steps instead, and then the workflow continues.

Use it when several steps belong together. For example: create an invoice, charge the card and send the receipt, and if any of them fails, notify the finance channel and carry on with the next order.

The three outputs​

OutputWhat runs there
TryThe steps to protect. Every step you reach from Try belongs to the group.
CatchThe fallback steps. They run once when a step in the group fails.
DoneWhat comes next, after the group succeeded or the failure was handled.

Connect the steps to protect to Try, your fallback steps to Catch, and whatever should happen afterwards to Done. Done always runs once the scope is settled, so the workflow keeps going either way.

What Catch receives​

The first Catch step receives the error and the items the Try / Catch node received:

{
"error": {
"message": "Card declined",
"type": "EXTERNAL_SERVICE",
"nodeId": "charge-card",
"nodeLabel": "Charge card",
"nodeType": "store/stripe",
"attempt": 1
},
"input": { "orderId": "A-1001" }
}

Connection secrets are removed from the message before Catch sees it.

What Done receives​

Done receives the scope result. Read it in any later step, for example $node["Try / Catch"].json.status.

FieldMeaning
statussucceeded, caught or ignored.
attemptsHow many times the protected steps ran.
outputThe outputs of the last protected steps, keyed by step id. After a failure, the Fallback output, or null.
errorThe failure that was handled (as Catch received it), or null.
catchOutputThe outputs of the last Catch steps, keyed by step id, or null.

Settings​

SettingWhat it does
On errorRun Catch, then continue on Done (default). Ignore the error and continue on Done: Catch does not run, and Done gets the error and the fallback output. Run Catch, then fail the run: use Catch for cleanup or an alert, then the run fails with the original error, so the workflow's Error Trigger still fires.
Fallback outputOptional. What Done passes on as output when the steps failed. Type JSON, or an expression such as ${output.error.message} (the scope's items, plus the error under error).
Error types to catchOptional, comma separated, for example NETWORK, RATE_LIMIT, TIMEOUT. Other errors are not caught: they go to an outer Try / Catch, or fail the run. Empty catches every error.
Run the steps up to (attempts)1 to 10. Above 1, a failure runs every protected step again before Catch. 1 means no retry.
Delay before the next attempt, Backoff multiplier, Longest delayThe wait between attempts: the delay grows by the multiplier after each attempt, up to the longest delay. The run waits without holding a worker.
Error types to retryOptional, comma separated. Only these errors run the steps again; others go straight to Catch. Empty retries every caught error.

How failures are handled​

  • A step's own error setting comes first. A step set to Continue or to an error branch in its own Settings handles its failure itself; the Try / Catch only sees failures a step does not handle. A step's own retries also run before the Try / Catch sees the failure.
  • Parallel branches. When the group has several branches and one fails, the first failure wins. Steps that have not started are skipped, steps already running finish but nothing after them runs, and Catch runs once.
  • Nested scopes. A Try / Catch can sit inside another one. The inner one handles its steps' failures first. If the inner Catch path fails, or the inner scope fails the run on purpose, the outer Try / Catch handles that failure.
  • Inside a Loop. Each loop item gets its own Try / Catch outcome. Connect Done back to the Loop to continue with the next item.

Rules when you save​

FluidGrids checks a Try / Catch when you save the workflow, and names the node and step when something is wrong:

  • Protected steps are reached only through Try. A protected step must not also be reached from a step outside the group, or from Done. To continue after the group, use Done.
  • Catch steps are reached only through Catch.
  • No step leads back into the Try / Catch node.
  • Two Try / Catch nodes either nest or protect different steps.
  • A group that runs more than once (attempts above 1) cannot contain a step that must not repeat: a trigger, Respond to Webhook, Send and Wait for Response, or Wait for Signal. Set attempts to 1, or move the step out of the group.

A Try / Catch with nothing connected to Try yet saves with a warning, so you can build the workflow step by step. Until steps are connected, it passes its items straight on to Done.

Try / Catch or a sub-workflow?​

Before Try / Catch existed, the way to protect a group of steps was to move them into a sub-workflow and set the Execute Workflow step's error handling to branch. That still works, and it is the right choice when the same steps are reused by several workflows. For a group used in one place, Try / Catch keeps the steps on the same canvas, retries the whole group, and gives Done the scope result.

Durable functions​

Try / Catch protects steps of a canvas workflow. In a durable function (code), wrap the calls in your language's own try / catch instead.

Out of scope​

Try / Catch does not undo what the failed steps already did in other services, such as a charge that went through before a later step failed. Put the compensating steps (a refund, a cancellation) on the Catch path.