in src/Runtime.js [33:54]
scheduleIteration() {
let that = this;
setImmediate(() => {
that.handleOnce().then(
// Success is a no-op at this level. There are 2 cases:
// 1 - The user used one of the callback functions which already
// schedules the next iteration.
// 2 - The next iteration is not scheduled because the
// waitForEmptyEventLoop was set. In this case the beforeExit
// handler will automatically start the next iteration.
() => {},
// Errors should not reach this level in typical execution. If they do
// it's a sign of an issue in the Client or a bug in the runtime. So
// dump it to the console and attempt to report it as a Runtime error.
(err) => {
console.log(`Unexpected Top Level Error: ${err.toString()}`);
this.errorCallbacks.uncaughtException(err);
},
);
});
}