Cleanup duplicate code in e2e tests...
Also add uncaughtException handling in datasource-invoke.