diff --git a/lib/browser.js b/lib/browser.js index 201a50b49..32ea98285 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -32,6 +32,9 @@ Browser.prototype.listen = function listen (host, port) { var res = JSON.parse(data) self.emit('message', res) }) + ws.on('error', err => { + console.log('websocket error', err) + }) self.lastConnectionErrorLog = null self.emit('connected') }) diff --git a/lib/ssuboard/board-manager.js b/lib/ssuboard/board-manager.js index 021727d12..f8dd83313 100644 --- a/lib/ssuboard/board-manager.js +++ b/lib/ssuboard/board-manager.js @@ -8,15 +8,17 @@ const ledManager = require('./led-manager') module.exports = { run } function run () { - ledManager.run() - .catch(err => console.log('ledManager error', err)) + const ledsPromise = ledManager.run() + .catch(err => { + console.log('ledManager error', err) + throw err + }) - const tasks = [ + const seriesPromise = pSeries([ io.run, fobManager.run, doorManager.run - ] + ]).catch(err => console.log('boardManager error', err)) - return pSeries(tasks) - .catch(err => console.log('boardManager error', err)) + return Promise.all([ledsPromise, seriesPromise]) }