]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix: do not nullify wsConnection in onError handler
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 2 May 2026 21:21:24 +0000 (23:21 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 2 May 2026 21:21:24 +0000 (23:21 +0200)
The ws library guarantees that a 'close' event always follows an 'error'
event. Eagerly setting wsConnection to null in onError caused the
subsequent onClose handler to emit an 'updated' event with wsState
undefined, making the UI display 'unknown' instead of 'closed'.

src/charging-station/ChargingStation.ts

index 64591099d92f1f692c2eedcacfb9d8726ee62f97..7f9819912585b9a135c45aca052c1bae88d11fd5 100644 (file)
@@ -2280,7 +2280,6 @@ export class ChargingStation extends EventEmitter {
   }
 
   private onError (error: WSError): void {
-    this.closeWSConnection()
     logger.error(`${this.logPrefix()} ${moduleName}.onError: WebSocket error:`, error)
   }