node-ble icon indicating copy to clipboard operation
node-ble copied to clipboard

Crash with uncaught exception of type Napi::Error

Open desdoo opened this issue 1 year ago • 0 comments

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?

desdoo avatar Feb 01 '24 20:02 desdoo