Skip to content

Commit

Permalink
fix: add error handling on websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelTaranto authored and joshmh committed Dec 9, 2019
1 parent 60b796a commit ca6b662
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand Down
14 changes: 8 additions & 6 deletions lib/ssuboard/board-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}

0 comments on commit ca6b662

Please sign in to comment.