From 77d523e1de5128d723483b932b9dbb98c194a7ed Mon Sep 17 00:00:00 2001 From: Petr Severa Date: Tue, 18 Nov 2025 13:27:18 +0100 Subject: [PATCH] Refactor error handling to use arrow function --- src/connection/nodejs_serial_connection.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/connection/nodejs_serial_connection.js b/src/connection/nodejs_serial_connection.js index 6ee4caa..3f3d617 100644 --- a/src/connection/nodejs_serial_connection.js +++ b/src/connection/nodejs_serial_connection.js @@ -30,9 +30,9 @@ class NodeJSSerialConnection extends SerialConnection { this.onDisconnected(); }); - this.serialPort.on("error", function(err) { - console.error("SerialPort Error: ", err.message); - this.emit("error", err); + this.serialPort.on("error", (error) => { + console.error("SerialPort Error: ", error.message); + this.emit("error", error); }); this.serialPort.on("data", async (data) => {