From 6983b6af5f678aa7884692697102c95ac9f13f85 Mon Sep 17 00:00:00 2001 From: Albert Date: Mon, 9 Mar 2026 20:59:48 +0100 Subject: [PATCH] fix: prevent unhandled promise rejection when fetching state --- src/BleManager.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/BleManager.js b/src/BleManager.js index 933dcdddd..4e388873d 100644 --- a/src/BleManager.js +++ b/src/BleManager.js @@ -316,11 +316,16 @@ export class BleManager { if (emitCurrentState) { var cancelled = false - this._callPromise(this.state()).then(currentState => { - if (!cancelled) { - listener(currentState) + this._callPromise(this.state()).then( + currentState => { + if (!cancelled) { + listener(currentState) + } + }, + () => { + // Prevent unhandled promise rejection for internal state fetch. } - }) + ) wrappedSubscription = { remove: () => {