From: Jérôme Benoit Date: Fri, 4 Feb 2022 23:23:25 +0000 (+0100) Subject: Reorder condition check X-Git-Tag: v1.1.45~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=623bbc14a643de4ccd9278788bb045e8d630a814;p=e-mobility-charging-stations-simulator.git Reorder condition check Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 363db744..e459bc07 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -29,7 +29,7 @@ export default abstract class OCPPRequestService { skipBufferingOnError: false, triggerMessage: false }): Promise { - if ((this.chargingStation.isInPendingState() && !params.triggerMessage) || this.chargingStation.isInRejectedState()) { + if (this.chargingStation.isInRejectedState() || (this.chargingStation.isInPendingState() && !params.triggerMessage)) { throw new OCPPError(ErrorType.SECURITY_ERROR, 'Cannot send command payload if the charging station is not in accepted state', commandName); } else if (this.chargingStation.isInAcceptedState() || (this.chargingStation.isInPendingState() && params.triggerMessage)) { // eslint-disable-next-line @typescript-eslint/no-this-alias