Errors should break the flow

Hello,
I am expecting that, when an unhandled error appear in one block, the following chain should break and the workflow fail altogether
The strange thing is that apparently the block "ends" before the script inside finishes. Note that the script has a "Promise".
An this latter is probably the reason why the workflow didn't break.

Thank you for your feedback.

Here is the "lying" block
image

Also the insert_codes function
image

And the failing authentication_codes_insert query:
image

Here is the Log:

Oh, I think I have found the reason:

the above insert_codes function:

const results = products.map((product) => {
  return fetch_product_codes(product)
    .then((records) => {
      authentication_codes_insert(records.data)
      return records.data.length
    })
});
return Promise.all(results);

should be:

const results = products.map((product) => {
  return fetch_product_codes(product)
    .then((records) => {
      authentication_codes_insert(records.data)
       .then(() => { return records.data.length) };
    })
});
return Promise.all(results);

So that it doesn't return without finishing the code...

1 Like

@lonesoft welcome to the community :tada: Thank you for sharing the solution back here for others to learn who see this going forward!