neo4j-apoc-procedures
neo4j-apoc-procedures copied to clipboard
Add a new function similar to apoc.periodic.iterate() but will raise an error when any batch fails
Feature description (Mandatory)
I'm using apoc.periodic.iterate()
to iterate nodes and perform actions on each node. Sometimes, some of the actions would fail. However, when any action fails, the call to apoc.periodic.iterate()
is still successful. Therefore, the queries following the call will still be executed. I find it inconvenient because I don't want the following queries to be executed when the call to apoc.periodic.iterate()
fails. In addition to that, I'm using cypher-shell
command to execute by queries, and I want cypher-shell
to exit with a non-zero status code if any of the action fails in the call to apoc.periodic.iterate()
.
My proposal is to add a new function similar to apoc.periodic.iterate()
and raise an error when any batch fails. That way, it can prevent the following queries to be executed and make cypher-shell
exit with a non-zero status code when error occurs.
Considered alternatives
I know that I can check the output parameters failedOperations
and failedBatches
that returned from the call to apoc.periodic.iterate()
to know if the call has failed or not, but I didn't find any way to raise an error with the help of these 2 output parameters.
How this feature can improve the project?
This new function is a general-purpose function, so I think many will find it helpful.