webserver: Emit websocket outputError and show error on the landing page.

Whenever outputError is emitted by Ember, display error message on the landing page
and stop the page from refreshing every four seconds.

Refs: https://github.com/embark-framework/embark/issues/946
This commit is contained in:
Cryptomental 2018-10-01 22:58:42 +02:00
parent 79d8dc8dca
commit bc68687994
2 changed files with 9 additions and 1 deletions

View File

@ -50,6 +50,11 @@ class Server {
ws.send('outputDone'); ws.send('outputDone');
}); });
}); });
self.events.on('outputError', () => {
if (ws.readyState === WEB_SOCKET_STATE_OPEN) {
return ws.send('outputError');
}
});
}); });
async.waterfall([ async.waterfall([

View File

@ -30,6 +30,9 @@
ws.addEventListener('message', (evt) => { ws.addEventListener('message', (evt) => {
if(evt.data === 'outputDone') { if(evt.data === 'outputDone') {
location.reload(true); location.reload(true);
} else if(evt.data === 'outputError') {
document.getElementsByClassName("loading-msg")[0].innerHTML = "Error building dapp, please check console";
window.stop()
} }
}); });
</script> </script>