fix: ensure the second stage at handling incoming request is executed
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 29 Jan 2024 20:06:59 +0000 (21:06 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 29 Jan 2024 20:06:59 +0000 (21:06 +0100)
later the response is sent

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts

index ef87992592780402b57f52584cab7cf3584ce175..53f87ab2667e089824c84632654dbbc413444492 100644 (file)
@@ -595,7 +595,6 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
             chargingStation,
             commandPayload
           )) as ResType
-          this.emit(commandName, chargingStation, commandPayload, response)
         } catch (error) {
           // Log
           logger.error(
@@ -636,6 +635,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       response,
       commandName
     )
+    this.emit(commandName, chargingStation, commandPayload, response)
   }
 
   private validatePayload (
index a11026d8c0068c49fcecbe5b348f92c2c7bec1a9..98436cfd704ac74feed48c86a5b443e3ae49631f 100644 (file)
@@ -95,7 +95,6 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
             chargingStation,
             commandPayload
           )) as ResType
-          this.emit(commandName, chargingStation, commandPayload, response)
         } catch (error) {
           // Log
           logger.error(
@@ -136,6 +135,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
       response,
       commandName
     )
+    this.emit(commandName, chargingStation, commandPayload, response)
   }
 
   private validatePayload (