From 4d634c78be0094af5aa6b2b27e6572452e15bffd Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Thu, 15 Nov 2018 07:45:55 +0000 Subject: [PATCH] Catch asynchronous errors --- packages/core/src/ground.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/ground.js b/packages/core/src/ground.js index c16307f..bd4afb9 100644 --- a/packages/core/src/ground.js +++ b/packages/core/src/ground.js @@ -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) {