Fixlets to OCPP error message format, take 2
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 17 Apr 2022 14:28:31 +0000 (16:28 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 17 Apr 2022 14:28:31 +0000 (16:28 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index c3c75ba0bde0fe8dd9664ffea570e96c72abe64f..a187ddd0fbde9644b5fa741cf75f69717ef7afb8 100644 (file)
@@ -1521,16 +1521,15 @@ export default class ChargingStation {
               );
             }
             logger.debug(
-              `${this.logPrefix()} << Command '${requestCommandName}' received response payload: ${JSON.stringify(
-                request
-              )}`
+              `${this.logPrefix()} << Command '${
+                requestCommandName ?? ''
+              }' received response payload: ${JSON.stringify(request)}`
             );
             if (!responseCallback) {
               // Error
               throw new OCPPError(
                 ErrorType.INTERNAL_ERROR,
-                `Response for unknown message id ${messageId}`,
-                requestCommandName
+                `Response for unknown message id ${messageId}`
               );
             }
             responseCallback(commandPayload, requestPayload);
@@ -1548,16 +1547,15 @@ export default class ChargingStation {
               );
             }
             logger.debug(
-              `${this.logPrefix()} << Command '${requestCommandName}' received error payload: ${JSON.stringify(
-                request
-              )}`
+              `${this.logPrefix()} << Command '${
+                requestCommandName ?? ''
+              }' received error payload: ${JSON.stringify(request)}`
             );
             if (!rejectCallback) {
               // Error
               throw new OCPPError(
                 ErrorType.INTERNAL_ERROR,
-                `Error response for unknown message id ${messageId}`,
-                requestCommandName
+                `Error response for unknown message id ${messageId}`
               );
             }
             rejectCallback(