Message from JavaScript discussions
December 2018
— This is the dispatcher error handler code
if (block.stack.length === 0) {
debugLog("Stopping Dispatcher due to an uncaught error...\n");
this.stop();
throw error;
}
— Just says "if call stack empty, throw the error up"
— So perhaps I will look into a thenable, but how will it run the callback?
— If the error happens concurrently, should the callback spawn as a new coroutine?
—
function tester() {
return 123;
}
const thenable = spawn tester();
thenable.then(value => doSomething).catch(error => doSomething);
— There is also a temporal dead zone here I'd have to address
— Yes
— ?
— 1. spawn runs, queues coroutine ahead of current one
2. new coroutine runs, returns value
3. first coroutine sets thenable to get the value
— .then(
value => doSomething,
error => doSomething)
— So the return value is returned before there is a then
set