From: Jérôme Benoit Date: Sun, 21 Jan 2024 14:48:58 +0000 (+0100) Subject: fix: handle WebSocket opening error X-Git-Tag: v1.2.33~36 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5a15db9001b93665ab7581d2974c5f01a9e0fbe3;p=e-mobility-charging-stations-simulator.git fix: handle WebSocket opening error Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 10b32dce..e9d94651 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -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))