Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Log early OCPP command payload
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
  • Loading branch information
Jérôme Benoit committed Apr 13, 2022
1 parent 370ae4e commit 5c370ef
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/charging-station/ChargingStation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1504,17 +1504,17 @@ export default class ChargingStation {
if (this.getEnableStatistics()) {
this.performanceStatistics.addRequestStatistic(commandName, messageType);
}
logger.debug(
`${this.logPrefix()} << Command '${commandName}' received request payload: ${JSON.stringify(
request
)}`
);
// Process the call
await this.ocppIncomingRequestService.handleRequest(
messageId,
commandName,
commandPayload
);
logger.debug(
`${this.logPrefix()} << Command '${commandName}' received request payload: ${JSON.stringify(
request
)}`
);
break;
// Outcome Message
case MessageType.CALL_RESULT_MESSAGE:
Expand All @@ -1529,6 +1529,11 @@ export default class ChargingStation {
requestCommandName
);
}
logger.debug(
`${this.logPrefix()} << Command '${requestCommandName}' received response payload: ${JSON.stringify(
request
)}`
);
if (!responseCallback) {
// Error
throw new OCPPError(
Expand All @@ -1538,11 +1543,6 @@ export default class ChargingStation {
);
}
responseCallback(commandName, requestPayload);
logger.debug(
`${this.logPrefix()} << Command '${requestCommandName}' received response payload: ${JSON.stringify(
request
)}`
);
break;
// Error Message
case MessageType.CALL_ERROR_MESSAGE:
Expand All @@ -1555,6 +1555,11 @@ export default class ChargingStation {
`Cached request for message id ${messageId} error response is not iterable`
);
}
logger.debug(
`${this.logPrefix()} << Command '${requestCommandName}' received error payload: ${JSON.stringify(
request
)}`
);
if (!rejectCallback) {
// Error
throw new OCPPError(
Expand All @@ -1566,11 +1571,6 @@ export default class ChargingStation {
rejectCallback(
new OCPPError(commandName, commandPayload.toString(), requestCommandName, errorDetails)
);
logger.debug(
`${this.logPrefix()} << Command '${requestCommandName}' received error payload: ${JSON.stringify(
request
)}`
);
break;
// Error
default:
Expand Down

0 comments on commit 5c370ef

Please sign in to comment.