Skip to content

Commit 63edb52

Browse files
committed
chore: use async
1 parent aea9fb4 commit 63edb52

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/bluetooth.android.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,26 +1781,22 @@ export class Bluetooth extends BluetoothCommon {
17811781
public async disconnect(args: DisconnectOptions) {
17821782
const methodName = 'disconnect';
17831783
if (!args.UUID) {
1784-
return Promise.reject(
1785-
new BluetoothError(BluetoothCommon.msg_missing_parameter, {
1786-
method: methodName,
1787-
type: BluetoothCommon.UUIDKey,
1788-
arguments: args,
1789-
})
1790-
);
1784+
throw new BluetoothError(BluetoothCommon.msg_missing_parameter, {
1785+
method: methodName,
1786+
type: BluetoothCommon.UUIDKey,
1787+
arguments: args,
1788+
});
17911789
}
17921790
const pUUID = args.UUID;
17931791
const connection = this.connections[pUUID];
17941792
if (Trace.isEnabled()) {
17951793
CLog(CLogTypes.info, methodName, '---- connection:', pUUID);
17961794
}
17971795
if (!connection) {
1798-
return Promise.reject(
1799-
new BluetoothError(BluetoothCommon.msg_peripheral_not_connected, {
1800-
method: methodName,
1801-
arguments: args,
1802-
})
1803-
);
1796+
throw new BluetoothError(BluetoothCommon.msg_peripheral_not_connected, {
1797+
method: methodName,
1798+
arguments: args,
1799+
});
18041800
}
18051801
connection.device.disconnect();
18061802
}

0 commit comments

Comments
 (0)