fix: handle WebSocket opening error
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 21 Jan 2024 14:48:58 +0000 (15:48 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 21 Jan 2024 14:48:58 +0000 (15:48 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 10b32dce9ca2f632dfb9b6f59573b1a1dc409982..e9d94651d1d2dd57fccd4440708663206592a4d5 100644 (file)
@@ -777,7 +777,9 @@ export class ChargingStation extends EventEmitter {
     this.wsConnection.on('close', this.onClose.bind(this))
     // Handle WebSocket open
     this.wsConnection.on('open', () => {
-      this.onOpen().catch(Constants.EMPTY_FUNCTION)
+      this.onOpen().catch(error =>
+        logger.error(`${this.logPrefix()} Error while opening WebSocket connection:`, error)
+      )
     })
     // Handle WebSocket ping
     this.wsConnection.on('ping', this.onPing.bind(this))