Skip to content

Commit 5b95268

Browse files
committed
chore: better bluetooth error reporting
1 parent dfe4eb8 commit 5b95268

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ble/index.common.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ export class BluetoothError extends BaseError {
2626
Object.assign(this, properties);
2727
}
2828
}
29+
2930
toString() {
30-
return `[BluetoothError]:${this.message} in:${this.method}${this.status ? ` with status:${this.status}` : ''}${
31-
this.nativeException ? ` with nativeException:${this.nativeException}` : ''
32-
} args: ${JSON.stringify(this.arguments)}`;
31+
return `[BluetoothError]:${this.message}${Object.keys(this).map((k) => {
32+
if (k === 'message') {
33+
return '';
34+
}
35+
const value = this[k];
36+
return `,${k}: ${JSON.stringify(value)}`;
37+
})}`;
3338
}
3439
}
3540

0 commit comments

Comments
 (0)