Error handling at node level (detect node execution status) [GOT CREATED]

Nodes execution status/result, should be an optional condition to determine a workflow direction/path. Example:

image


  • Explanation:

Currently, it is possible to configure each node to “Retry on fail” or “Continue on fail”:

image

It would be GREAT to also have the option inside each node, to “re-route” the workflow if the node fails, without the need of a IF node, or an Error Workflow/Node. Example:

image


- Current workarounds and problems (for the lack of this feature):

Basically, the issue currently is that we can’t know a specific node execution status (if this has succesfully been executed or failed during execution), unless we add additional nodes to try to detect these errors. But the current workarounds and methods to achieve this adds complexity to the workflows, are inconsistent (as we can’t make sure we catch all the possible errors), or even worse: the corrective action can’t be executed DURING the worklow execution/error detection.

  • The main issue using an additional IF node to detect/or to detect if a specific node fails, is that 1) adds complexity to the workflow, 2) The condition to determine if the previous node failed it has to be literal. Example of the issue and the workarounds that needs to be made to solve this: IF node following a Failed node - #2 by harshil1712

  • The other issue using an Error Trigger, is that this doesn’t allow to handle the error or change the workflow steps DURING the execution, based on a node execution success/fail. This error handling method is good for alerts, corrective actions, but only AFTER the workflow has failed and stopped.


- The proposed solution:

The main idea of this feature is to have the additional option (toggle) on the nodes settings, that allows to enable/disable a Error Detection handler (let’s call this feature for now "Execution status output
"). Example:

image

  • If disabled (by default): the node has one only output. This is the “normal” nodes output type as it currently works:

image

  • If enabled: the node will have 2 outputs (success / error). Each output allow to direct the worklow based on the node execution status.

image

I hope the idea is clear, please feel free to comment your thoughts. :slight_smile:
Thank you in advance!

I can see why some might find this useful, personally I prefer the if node approach but if this is what the community vote for it may happen :slightly_smiling_face:

1 Like

Thanks Jon!

I was hoping for something similar recently. A corresponding option for some of the node options that would enable a specific output.

E.g. I have a workflow the needs to process 0-X subitems. If after filtering there are 1+ items, we run some more nodes and populate an HTML section, however if there are no items, we still need to continue the workflow just without populating that section.

It means I have to filter (with always output data) → run code node to detect empty output → IF on the empty output

If I had a specific outputs that matched node settings, I could just use the No Items output.
Always Output Data → option to output No Items
Continue On Fail → option to output Errors separate from successful items

1 Like

For context the Code node is non-trivial. Also it may be that I’m just overlooking a simple and obvious solution to this problem?

// If we don't have any findings output an empty: true object
if ($input.all().length == 1 && Object.keys($input.first().json).length == 0) {
  return [
    {
      json: { empty: true },
      pairedItem: 0,
    },
  ];
} else {
  return $input.all();
}
1 Like

fyi This is currently wip and will be released soon.
The PR can be found here.

2 Likes

:partying_face: :tada: :raised_hands:
Great to hear that, thank you!!

New version [email protected] got released which includes the GitHub PR 7460.

2 Likes

Can you explain a bit more how this works?

I have a MySQL node that receives, say, 100 items in the preceeding JSON, and then goes through each one to update my database. If one row update fails, it stops all the subsequent rows from updating. I am trying to prevent this.

If I set it to “Continue on Fail” it seems to just jump to the next node after the failure, which I don’t want, as it still hasn’t processed the MySQL row updates that came after the failed one.

If I do “Continue (using error output)” will it move the failed update query and all subsequent ones to the failure output, or will it just move the one that failed to the error output?

In other words, 100 items queued to be processed by a node. Item 2 fails. Will the remaining 98 also go to the error output, or will item 2 go to the error output and items 1 + 3-100 will go through the normal/success output?

It depends on the node, but the expected result would be each item is run and only items where an error occurred end up in the error output.

In your example item 2 would be in the error output and the 1st and remaining 98 items would go out the normal output.

See this example that generate a random number of 200 (success) or 404 (fail)

2 Likes

Thank you, that’s a big help!

Upon further testing, with the MySQL node set to “Continue using error output”, if you get an error like can’t connect to MySQL, it will route to the error output.

But if MySQL gives an error like “ERROR: Out of range value for column ‘price’ at row 1” it appears to stop executing at the query that errored out, does not send that query to the error side of the output, does not attempt to execute further queries that are queued, and everything goes to the “success” side. In other words, it behaves the same as before in terms of stopping at the error, but doesn’t produce any error message to let you know something went wrong.

That may be quite an old node and not handling errors the way most do :frowning: