Skip to content

Commit b75a4ed

Browse files
author
dbaba
committed
Swallow an exception while emitting characteristicsDiscover event
1 parent fcb3c0d commit b75a4ed

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/noble/lib/bluez/bindings.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,21 @@ class BluezBindings extends EventEmitter {
364364
}
365365
);
366366
debug(`resultChrs => ${JSON.stringify(resultChrs)}`);
367-
this.emit('characteristicsDiscover', deviceUuid, serviceUuid, resultChrs);
368-
debug(`[${deviceUuid}] OK. Found ${resultChrs.length} Characteristics.`);
367+
try {
368+
this.emit(
369+
'characteristicsDiscover',
370+
deviceUuid,
371+
serviceUuid,
372+
resultChrs
373+
);
374+
debug(
375+
`[${deviceUuid}] OK. Found ${resultChrs.length} Characteristics.`
376+
);
377+
} catch (err) {
378+
debug(
379+
`Failed to emit 'characteristicsDiscover' event. message:${err.message}`
380+
);
381+
}
369382
}, timeout);
370383
}
371384

0 commit comments

Comments
 (0)