Skip to content

Commit

Permalink
fix: Log socket errors zigbee2mqtt/hassio-zigbee2mqtt#644 (#1217)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk authored Oct 18, 2024
1 parent 3a8a9ff commit 96fc5e6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/adapter/deconz/driver/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion src/adapter/ember/uart/ash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export class UartAsh extends EventEmitter<UartAshEventMap> {
* @param error
*/
private async onPortError(error: Error): Promise<void> {
logger.info(`Port ${error}`, NS);
logger.error(`Port ${error}`, NS);
this.flags = 0;
this.emit('fatalError', EzspStatus.ERROR_SERIAL_INIT);
}
Expand Down
4 changes: 2 additions & 2 deletions src/adapter/z-stack/znp/znp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
3 changes: 1 addition & 2 deletions src/adapter/zigate/driver/zigate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,7 @@ export default class ZiGate extends EventEmitter<ZiGateEventMap> {

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;
});

Expand Down

0 comments on commit 96fc5e6

Please sign in to comment.