From ac54a9bbb3fee0a1168f982b2e1e37856a61ef2c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 17 Apr 2022 16:05:41 +0200 Subject: [PATCH] Fixlets to OCPP error message format MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index d2d509f0..c3c75ba0 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1517,8 +1517,7 @@ export default class ChargingStation { } else { throw new OCPPError( ErrorType.PROTOCOL_ERROR, - `Cached request for message id ${messageId} response is not iterable`, - requestCommandName + `Cached request for message id ${messageId} response is not iterable` ); } logger.debug( @@ -1573,12 +1572,9 @@ export default class ChargingStation { throw new OCPPError(ErrorType.PROTOCOL_ERROR, errMsg); } } else { - throw new OCPPError( - ErrorType.PROTOCOL_ERROR, - 'Incoming message is not iterable', - Utils.isString(commandName) ? commandName : requestCommandName, - { payload: request } - ); + throw new OCPPError(ErrorType.PROTOCOL_ERROR, 'Incoming message is not iterable', null, { + payload: request, + }); } } catch (error) { // Log @@ -1594,7 +1590,7 @@ export default class ChargingStation { (await this.ocppRequestService.sendError( messageId, error as OCPPError, - Utils.isString(commandName) ? commandName : requestCommandName + Utils.isString(commandName) ? commandName : requestCommandName ?? null )); } } -- 2.34.1