Fix OCPPError command attribute affectation
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 2 Sep 2021 20:07:40 +0000 (22:07 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 2 Sep 2021 20:07:40 +0000 (22:07 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/OCPPError.ts
src/charging-station/ocpp/OCPPRequestService.ts

index ed77d54c22fa3446677a96d2328ced2629d26c8f..9c6f825a6526a3f903c4b2a70e230b6fb2de3103 100644 (file)
@@ -13,7 +13,7 @@ export default class OCPPError extends Error {
     this.name = new.target.name;
     this.code = code ?? ErrorType.GENERIC_ERROR;
     this.message = message ?? '';
-    this.message = command ?? '';
+    this.command = command;
     this.details = details ?? {};
 
     Object.setPrototypeOf(this, new.target.prototype);
index a9f9b846d0d71785e4c12703e97384040fb39543..1e9df7cadd97458218d7117d1b8f51c4bd607b6f 100644 (file)
@@ -24,7 +24,7 @@ export default abstract class OCPPRequestService {
   }
 
   public async sendMessage(messageId: string, commandParams: any, messageType: MessageType, commandName: RequestCommand | IncomingRequestCommand,
-      skipBuffering = false): Promise<unknown> {
+      skipBufferingOnError = false): Promise<unknown> {
     // eslint-disable-next-line @typescript-eslint/no-this-alias
     const self = this;
     // Send a message through wsConnection
@@ -58,7 +58,7 @@ export default abstract class OCPPRequestService {
         const beginId = PerformanceStatistics.beginMeasure(commandName);
         this.chargingStation.wsConnection.send(messageToSend);
         PerformanceStatistics.endMeasure(commandName, beginId);
-      } else if (!skipBuffering) {
+      } else if (!skipBufferingOnError) {
         // Buffer it
         this.chargingStation.addToMessageQueue(messageToSend);
         // Reject it