mirror of
https://github.com/thegecko/web-bluetooth-dfu.git
synced 2026-03-15 21:23:17 +08:00
sendControl causing "uncaught in promise" error
Ran into a case where errors in sendControl could not be handled. Made change to explicitly handle and reject an errors happening in sendControl.
This commit is contained in:
@@ -306,10 +306,12 @@ export class SecureDfu extends EventDispatcher {
|
||||
}
|
||||
|
||||
private sendControl(operation: Array<number>, buffer?: ArrayBuffer): Promise<DataView> {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.sendOperation(this.controlChar, operation, buffer)
|
||||
.then(resp => {
|
||||
setTimeout(() => resolve(resp), this.delay);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user