Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Reorder condition check
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
  • Loading branch information
Jérôme Benoit committed Feb 4, 2022
1 parent 6705f49 commit 623bbc1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/charging-station/ocpp/OCPPRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default abstract class OCPPRequestService {
skipBufferingOnError: false,
triggerMessage: false
}): Promise<unknown> {
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
Expand Down

0 comments on commit 623bbc1

Please sign in to comment.