From: Jérôme Benoit Date: Thu, 12 Nov 2020 21:36:04 +0000 (+0100) Subject: Arguments renaming. X-Git-Tag: v1.0.1-0~202 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a324ad9bcb1cc056258f737f05574209de6dd06c;p=e-mobility-charging-stations-simulator.git Arguments renaming. Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index d783b281..18013db4 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -530,28 +530,28 @@ export default class ChargingStation { this._hasSocketRestarted = false; } - onError(error): void { - switch (error) { + onError(errorEvent): void { + switch (errorEvent) { case 'ECONNREFUSED': this._hasSocketRestarted = true; - this._reconnect(error); + this._reconnect(errorEvent); break; default: - logger.error(this._logPrefix() + ' Socket error: %j', error); + logger.error(this._logPrefix() + ' Socket error: %j', errorEvent); break; } } - onClose(error): void { - switch (error) { + onClose(closeEvent): void { + switch (closeEvent) { case 1000: // Normal close case 1005: - logger.info(this._logPrefix() + ' Socket normally closed %j', error); + logger.info(this._logPrefix() + ' Socket normally closed %j', closeEvent); this._autoReconnectRetryCount = 0; break; default: // Abnormal close this._hasSocketRestarted = true; - this._reconnect(error); + this._reconnect(closeEvent); break; } } @@ -560,11 +560,11 @@ export default class ChargingStation { logger.debug(this._logPrefix() + ' Has received a WS ping (rfc6455) from the server'); } - async onMessage(message): Promise { + async onMessage(messageEvent): Promise { let [messageType, messageId, commandName, commandPayload, errorDetails] = [0, '', Constants.ENTITY_CHARGING_STATION, '', '']; try { // Parse the message - [messageType, messageId, commandName, commandPayload, errorDetails] = JSON.parse(message); + [messageType, messageId, commandName, commandPayload, errorDetails] = JSON.parse(messageEvent); // Check the Type of message switch (messageType) { @@ -618,7 +618,7 @@ export default class ChargingStation { } } catch (error) { // Log - logger.error('%s Incoming message %j processing error %s on request content type %s', this._logPrefix(), message, error, this._requests[messageId]); + logger.error('%s Incoming message %j processing error %s on request content type %s', this._logPrefix(), messageEvent, error, this._requests[messageId]); // Send error await this.sendError(messageId, error, commandName); }