Add a new function similar to apoc.periodic.iterate() but will raise an error when any batch fails #3547
Labels
core-functionality
Adding new procedure, function or signature to APOC core
enhancement
extended-functionality
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 toapoc.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 toapoc.periodic.iterate()
fails. In addition to that, I'm usingcypher-shell
command to execute by queries, and I wantcypher-shell
to exit with a non-zero status code if any of the action fails in the call toapoc.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 makecypher-shell
exit with a non-zero status code when error occurs.Considered alternatives
I know that I can check the output parameters
failedOperations
andfailedBatches
that returned from the call toapoc.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.
The text was updated successfully, but these errors were encountered: