From ed25d9a656647b49a4291f3653f3be60aaebadb3 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Thu, 17 Oct 2024 22:25:22 +0200 Subject: [PATCH] fix: Log socket errors https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/644 --- src/adapter/deconz/driver/driver.ts | 4 ++-- src/adapter/ember/uart/ash.ts | 2 +- src/adapter/z-stack/znp/znp.ts | 4 ++-- src/adapter/zigate/driver/zigate.ts | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/adapter/deconz/driver/driver.ts b/src/adapter/deconz/driver/driver.ts index f5df769d7f..24f00a6b53 100644 --- a/src/adapter/deconz/driver/driver.ts +++ b/src/adapter/deconz/driver/driver.ts @@ -264,8 +264,8 @@ class Driver extends events.EventEmitter { this.socketPort!.once('close', this.onPortClose); - this.socketPort!.on('error', function () { - logger.debug('Socket error', NS); + this.socketPort!.on('error', function (error) { + logger.error(`Socket error ${error}`, NS); reject(new Error(`Error while opening socket`)); self.initialized = false; }); diff --git a/src/adapter/ember/uart/ash.ts b/src/adapter/ember/uart/ash.ts index 23f91b737c..48ff8d5122 100644 --- a/src/adapter/ember/uart/ash.ts +++ b/src/adapter/ember/uart/ash.ts @@ -558,7 +558,7 @@ export class UartAsh extends EventEmitter { * @param error */ private async onPortError(error: Error): Promise { - logger.info(`Port ${error}`, NS); + logger.error(`Port ${error}`, NS); this.flags = 0; this.emit('fatalError', EzspStatus.ERROR_SERIAL_INIT); } diff --git a/src/adapter/z-stack/znp/znp.ts b/src/adapter/z-stack/znp/znp.ts index a43e9751c3..483dd14add 100755 --- a/src/adapter/z-stack/znp/znp.ts +++ b/src/adapter/z-stack/znp/znp.ts @@ -161,8 +161,8 @@ class Znp extends events.EventEmitter { this.socketPort!.once('close', this.onPortClose.bind(this)); - this.socketPort!.on('error', function () { - logger.info('Socket error', NS); + this.socketPort!.on('error', function (error) { + logger.error(`Socket error ${error}`, NS); reject(new Error(`Error while opening socket`)); self.initialized = false; }); diff --git a/src/adapter/zigate/driver/zigate.ts b/src/adapter/zigate/driver/zigate.ts index f2bb8a7190..3e36a92e47 100644 --- a/src/adapter/zigate/driver/zigate.ts +++ b/src/adapter/zigate/driver/zigate.ts @@ -302,8 +302,7 @@ export default class ZiGate extends EventEmitter { this.socketPort!.on('error', (error) => { logger.error(`Socket error ${error}`, NS); - // reject(new Error(`Error while opening socket`)); - reject(); + reject(new Error(`Error while opening socket`)); this.initialized = false; });