diff --git a/website/_assets/js/tryFlow.js.es6.liquid b/website/_assets/js/tryFlow.js.es6.liquid index 021727ef6af..56d3011b722 100644 --- a/website/_assets/js/tryFlow.js.es6.liquid +++ b/website/_assets/js/tryFlow.js.es6.liquid @@ -114,7 +114,10 @@ function getAnnotations(text, callback, options, editor) { CodeMirror.signal(editor, 'flowCoverage', coverage); return coverage.expressions.uncovered_locs }) - .catch(() => []), + .catch(err => { + console.error(err) + return [] + }), flow .then(flowProxy => flowProxy.checkContent('-', text)) .then(errors => { @@ -245,7 +248,10 @@ class AsyncLocalFlow { } coverage(filename, body) { - return Promise.resolve(this._flow.coverage(filename, body)) + if (this._flow.coverage) { + return Promise.resolve(this._flow.coverage(filename, body)) + } + return Promise.reject(Error('coverage method is missing')) } dumpTypes(filename, body) { diff --git a/website/_assets/js/tryFlowWorker.js b/website/_assets/js/tryFlowWorker.js index 80da7e7f171..9a9fdc07ae2 100644 --- a/website/_assets/js/tryFlowWorker.js +++ b/website/_assets/js/tryFlowWorker.js @@ -34,8 +34,12 @@ this.onmessage = function(e) { return; case "coverage": getFlow(data.version).then(function(flow) { - var result = flow.coverage(data.filename, data.body); - postMessage({id: data.id, type: "coverage", result: result}); + if (flow.coverage) { + var result = flow.coverage(data.filename, data.body); + postMessage({id: data.id, type: "coverage", result: result}); + } else { + postMessage({id: data.id, type: "coverage", err: Error('coverage method is missing')}); + } })["catch"](function (e) { postMessage({id: data.id, type: "coverage", err: e}); })