Try catch the connection
This commit is contained in:
parent
df106e6e90
commit
58f8d09775
|
@ -11,6 +11,7 @@ function capitalize (s) {
|
|||
class Blootstrap {
|
||||
constructor () {
|
||||
this._onData = () => {}
|
||||
try {
|
||||
ipc.connectTo('blootstrap_ble', () => {
|
||||
ipc.of.blootstrap_ble.on('connect', () => {
|
||||
log.info('connect', `Connected to the blootstrap_ble service`)
|
||||
|
@ -26,10 +27,15 @@ class Blootstrap {
|
|||
})
|
||||
ipc.of.blootstrap_ble.on('error', (err) => {
|
||||
if (err.code === 'EACCES') {
|
||||
log.warn('error', `Cannot access ipc`)
|
||||
log.warn('ble', `Cannot access ipc`)
|
||||
} else {
|
||||
log.error('ble', { error : err })
|
||||
}
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
log.error('connectTo', { error : e })
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Binds functions to events that are triggered by BLE messages
|
||||
|
|
Loading…
Reference in New Issue