From 9292e32a92f3ef63ee5a3cf86dc497b8acae5d2d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 2 Sep 2021 22:07:40 +0200 Subject: [PATCH] Fix OCPPError command attribute affectation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ocpp/OCPPError.ts | 2 +- src/charging-station/ocpp/OCPPRequestService.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/charging-station/ocpp/OCPPError.ts b/src/charging-station/ocpp/OCPPError.ts index ed77d54c..9c6f825a 100644 --- a/src/charging-station/ocpp/OCPPError.ts +++ b/src/charging-station/ocpp/OCPPError.ts @@ -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); diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index a9f9b846..1e9df7ca 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -24,7 +24,7 @@ export default abstract class OCPPRequestService { } public async sendMessage(messageId: string, commandParams: any, messageType: MessageType, commandName: RequestCommand | IncomingRequestCommand, - skipBuffering = false): Promise { + skipBufferingOnError = false): Promise { // 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 -- 2.34.1