Error handling
Error handlers
Commit error handler
6 min
the commit error handler stops the run and commits changes in your database apps if your is not using apps that support transactions, like mysql or data store , the commit error handler just stops the modules that support transactions are labeled with the "acid" label before you use the rollback or commit error handlers, take a look at the docid\ evar6qlowv4yyuneyv 00 first the bundle that caused the error doesn't go through the rest of the flow doesn't process the rest of the bundles for example this demo contains five modules the is useful for tests and showing the effect of an error handler json parse json provides test data in the form of an array of three record ids iterator splits the array into individual bundles data store update a record updates the data in the data store data store update a record this module updates the data again this time the module works differently in the module mapping, there is a mapping that intentionally creates an error the mapping inserts a null value into the required key field, which always creates the bundlevalidationerror having two data store modules doing the same thing, but one of them failing, will make a good example for the commit and rollback error handlers slack send a message sends a message to a private testing channel this is how the example looks when we would run the example , we would get the bundlevalidationerror if we added the commit error handler to the update a record module, the commit error handler would stop processing the bundle in the and save changes to your data in database apps wouldn't process the remaining bundles let's check the data in the data store as well before running the , the data store contained the following data the mappings for the update a record modules the first module updates the id column to the number 4 and the name column to the text test 4 the second module updates the id column to the number 5 and the name column to the text test 5 after running the , would update the data in the data store the first bundle of data gets through the flow successfully and updates the first row of data in the data store both times the first row contains the update from the second update a record module id = 5, name = test 5 the second bundle gets to the first update a record module successfully, but causes an error in the second module the commit error handler saves the update in the first module, but prevents the update in the second module and stops the the second row contains the update from the first module only id = 4, name = test 4 doesn't update the third row because the commit error handler stopped the run already the data in the third row remain the same id = 3, name = test 3 for more information about error handling strategies check the docid 7 hehdtuu2xyys8 qurub stop the when an error happens with the commit error handler, you can stop the when an error happens saves changes in the database apps in your and doesn't process the rest of the bundles in the flow modules that support transactions are labeled with the "acid" label before you use the rollback or commit error handlers, take a look at the docid\ evar6qlowv4yyuneyv 00 first for example, the following outputs an error in the data store app module to stop the and save changes, follow the steps right click the module that is causing the error in the menu, select add error handler select the commit error handler save your make you added the commit error handler to your when an error occurs in the data store module, the stops and saves changes in modules that support transactions