Error handling
Error handlers
Commit error handler
6min
the commit error handler stops the {{scenario singular lowercase}} run and commits changes in your database apps if your {{scenario singular lowercase}} is not using apps that support transactions, like mysql or data store , the commit error handler just stops the {{scenario singular lowercase}} modules that support transactions are labeled with the "acid" label before you use the rollback or commit error handlers, take a look at the scenario settings docid\ evar6qlowv4yyuneyv 00 first the bundle that caused the error doesn't go through the rest of the {{scenario singular lowercase}} flow {{product name}} doesn't process the rest of the bundles for example this demo {{scenario singular lowercase}} contains five modules the {{scenario singular lowercase}} 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 {{scenario singular lowercase}} looks when we would run the example {{scenario singular lowercase}} , 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 {{scenario singular lowercase}} and save changes to your data in database apps {{product name}} wouldn't process the remaining bundles let's check the data in the data store as well before running the {{scenario singular lowercase}} , 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 {{scenario singular lowercase}} , {{product name}} would update the data in the data store the first bundle of data gets through the {{scenario singular lowercase}} 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 {{scenario singular lowercase}} the second row contains the update from the first module only id = 4, name = test 4 {{product name}} doesn't update the third row because the commit error handler stopped the {{scenario singular lowercase}} 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 overview of error handling docid 7 hehdtuu2xyys8 qurub stop the {{scenario singular lowercase}} when an error happens with the commit error handler, you can stop the {{scenario singular lowercase}} when an error happens {{product name}} saves changes in the database apps in your {{scenario singular lowercase}} and doesn't process the rest of the bundles in the {{scenario singular lowercase}} 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 scenario settings docid\ evar6qlowv4yyuneyv 00 first for example, the following {{scenario singular lowercase}} outputs an error in the data store app module to stop the {{scenario singular lowercase}} 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 {{scenario singular lowercase}} when an error occurs in the data store module, the {{scenario singular lowercase}} stops and {{product name}} saves changes in modules that support transactions