From 904a79208ee623834c9f023513a36c1c2fc4d779 Mon Sep 17 00:00:00 2001 From: Tommie Gannert Date: Thu, 18 Dec 2025 15:35:45 +0100 Subject: [PATCH] fix(hci): set code property to string errno in errors Fixes https://github.com/stoprocent/noble/issues/46 by adding back the property that was dropped in 59744ec. --- src/BluetoothHciSocket.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/BluetoothHciSocket.cpp b/src/BluetoothHciSocket.cpp index bc4ed6f..5bdc46b 100644 --- a/src/BluetoothHciSocket.cpp +++ b/src/BluetoothHciSocket.cpp @@ -80,6 +80,8 @@ void BluetoothHciSocket::EmitError(const Napi::CallbackInfo& info, const char *s Napi::Error error = Napi::Error::New(env, std::string(strerror(errno))); error.Set("syscall", Napi::String::New(env, syscall)); error.Set("errno", Napi::Number::New(env, errno)); + const char* errno_str = strerrorname_np(errno); + if (errno && errno_str) error.Set("code", Napi::String::New(env, errno_str)); try { // Get the value held by thisObj