Help! 1 branch has an error and workflow skips other branches

Hi! I'm not a software engineer, so please bear with me as I try to explain :joy:

My workflow's objective is to receive data from a webhook, then update Retool database.

However, the webhook's payload has multiple formats which forced me to add multiple branches (refer below).

Expected outcome: One of the branches would pick up the payload format, then update DB
Actual outcome: If one of the branches result into an error, it skips the rest of the branches (refer below)

So I tried to combine all the conditions into a single branch (refer below), but i'm still getting the same outcome.

Hello @mazni_JE!

I believe you need to implement global error handling in your workflow. You will notice that nodes should have an "Add global error handler" feature in the ... menu found in the upper right corner of the node:

image

Setting up a JS Node as a global error handler:
image

Now, the node has a little flag denoting it as the handler (you can only have one global handler in a workflow). The "Add global error handler" now reads "Remove error handler" as well to let us know that this is the global handler. The node, as usual, has settings and this is I think where you would want to set the "Finally" option to continue.

With the handler setup, you just have to decide what it does. In your case it seems like you are having an issue with null data properties. This might not need a global handler at all as you can maybe adjust your processing logic to first check that the data you are looking for exists and then using your branching nodes wouldn't error.

For example, if your branch condition requires a startTrigger.data.event, you could use startTrigger.data.event && startTrigger.data.event === 'taskDeleted' or possibly startTrigger.data.event? === 'taskDeleted'.

Either way, the global handler should let your workflow continue as it parses through the branches that are missing event or history_items properties.

Hi @pyrrho, thanks for replying!

Here are my updates:

  1. The global error handler doesn't work, as the branch nodes don't have "Add global error handler" option.
    2. Changing the branch logic worked!
    Screenshot 2025-02-25 at 2.01.16 PM
1 Like

@mazni_JE

Awesome! Glad that there was some progress.

For the future, the global error handler node wouldn't be in the branches, but a separate node entirely (I have used a JS Node for this just to catch/log things).

Once that other node is setup, it will be disconnected from the main workflow (no nodes will attach TO it) and only run when other nodes (like your branches) encounter errors.

I believe that you can also connect nodes after to error handler to do other things (like write to a DB or whatever).