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

Commit

Permalink
Improve error information at OCPP incoming message handling
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
  • Loading branch information
Jérôme Benoit committed Apr 17, 2022
1 parent 9934652 commit c2bc716
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/charging-station/ChargingStation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
Expand All @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit c2bc716

Please sign in to comment.