From 8be1e4e29f253ac09277d25c81139dcfd116ee9a Mon Sep 17 00:00:00 2001 From: Ben <43026681+bwp91@users.noreply.github.com> Date: Fri, 28 Jul 2023 10:30:58 +0100 Subject: [PATCH] fix: catch error on `this._bindings.init()` --- lib/noble.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/noble.js b/lib/noble.js index e4bb5133..1678b587 100644 --- a/lib/noble.js +++ b/lib/noble.js @@ -58,7 +58,11 @@ function Noble (bindings) { this.initialized = true; process.nextTick(() => { - this._bindings.init(); + try { + this._bindings.init(); + } catch (error) { + this.emit('warning', 'Initialization of USB device failed: ' + error.message); + } }); } });