From: Jérôme Benoit Date: Tue, 19 May 2020 12:22:46 +0000 (+0200) Subject: Give more informations on JSON parsing error. X-Git-Tag: v1.0.1-0~325 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2d8cee5a8b6816947f4455ef53e088572c5b1671;p=e-mobility-charging-stations-simulator.git Give more informations on JSON parsing error. Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.js b/src/charging-station/ChargingStation.js index 99532afa..6b9bfc2a 100644 --- a/src/charging-station/ChargingStation.js +++ b/src/charging-station/ChargingStation.js @@ -180,10 +180,11 @@ class ChargingStation { } async onMessage(message) { - // Parse the message - const [messageType, messageId, commandName, commandPayload, errorDetails] = JSON.parse(message); - + let [messageType, messageId, commandName, commandPayload, errorDetails] = [0, '', Constants.ENTITY_CHARGING_STATION, '', '']; try { + // Parse the message + [messageType, messageId, commandName, commandPayload, errorDetails] = JSON.parse(message); + // Check the Type of message switch (messageType) { // Incoming Message