Catch asynchronous errors

This commit is contained in:
Tony Garnock-Jones 2018-11-15 07:45:55 +00:00
parent c86b213861
commit 4d634c78be
1 changed files with 7 additions and 1 deletions

View File

@ -18,7 +18,13 @@ Ground.prototype = new Dataspace(null);
Ground._resolved = Promise.resolve();
Ground.laterCall = function (thunk) {
Ground._resolved.then(thunk);
Ground._resolved.then(() => {
try {
thunk();
} catch (e) {
console.error("SYNDICATE/JS INTERNAL ERROR", e);
}
});
};
Ground.prototype.backgroundTask = function (k) {