node-ble
node-ble copied to clipboard
Crash with uncaught exception of type Napi::Error
Hey,
When running my Node.js application that uses the @abandonware/noble
library to interact with Bluetooth devices, the application crashes with the following error message:
libc++abi: terminating with uncaught exception of type Napi::Error
zsh: abort node getDTC.js
This occurs after successfully discovering a device and attempting to send a command to a characteristic.
/Relevant part of the code that leads to the crash
function sendCommand(characteristic, command) {
const bufferCommand = Buffer.from(command, 'hex');
characteristic.write(bufferCommand, false, (error) => {
if (error) {
console.error(Error writing command ${command} to characteristic ${characteristic.uuid}:, error);
} else {
console.log(Command ${command} sent to characteristic ${characteristic.uuid});
}
});
}
Any idea?