From c2bc716fae3113f20ac1b339038f566d06ee1e1b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 17 Apr 2022 21:51:22 +0200 Subject: [PATCH] Improve error information at OCPP incoming message handling 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 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index b570f74a..9f3ad1ed 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1517,7 +1517,9 @@ export default class ChargingStation { } else { throw new OCPPError( ErrorType.PROTOCOL_ERROR, - `Cached request for message id ${messageId} response is not iterable` + `Cached request for message id ${messageId} response is not iterable`, + null, + cachedRequest as unknown as JsonType ); } logger.debug( @@ -1529,7 +1531,9 @@ export default class ChargingStation { // Error throw new OCPPError( ErrorType.INTERNAL_ERROR, - `Response for unknown message id ${messageId}` + `Response for unknown message id ${messageId}`, + null, + commandPayload ); } responseCallback(commandPayload, requestPayload); @@ -1543,7 +1547,9 @@ export default class ChargingStation { } else { throw new OCPPError( ErrorType.PROTOCOL_ERROR, - `Cached request for message id ${messageId} error response is not iterable` + `Cached request for message id ${messageId} error response is not iterable`, + null, + cachedRequest as unknown as JsonType ); } logger.debug( @@ -1555,7 +1561,9 @@ export default class ChargingStation { // Error throw new OCPPError( ErrorType.INTERNAL_ERROR, - `Error response for unknown message id ${messageId}` + `Error response for unknown message id ${messageId}`, + null, + { errorType, errorMessage, errorDetails } ); } rejectCallback( -- 2.34.1