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 committed by Pascal Precht
parent 78c5055902
commit 34cafc77e8
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 9 additions and 1 deletions

View File

@ -44,6 +44,11 @@ class Server {
wss.clients.forEach(function (client) { wss.clients.forEach(function (client) {
client.send('outputDone'); client.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>