if (filename && event === 'change') {
try {
logger.debug(
- this.logPrefix(file) +
- ' ' +
- FileType.Authorization +
- ' file have changed, reload'
+ `${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload`
);
this.deleteTags(file);
this.deleteFSWatcher(file);
);
}
} else {
- logger.info(this.logPrefix(file) + ' No authorization file given)');
+ logger.info(`${this.logPrefix(file)} No authorization file given`);
}
return authorizedTags;
}
private async internalStartConnector(connectorId: number): Promise<void> {
this.setStartConnectorStatus(connectorId);
logger.info(
- this.logPrefix(connectorId) +
- ' started on connector and will run for ' +
- Utils.formatDurationMilliSeconds(
- this.connectorsStatus.get(connectorId).stopDate.getTime() -
- this.connectorsStatus.get(connectorId).startDate.getTime()
- )
+ `${this.logPrefix(
+ connectorId
+ )} started on connector and will run for ${Utils.formatDurationMilliSeconds(
+ this.connectorsStatus.get(connectorId).stopDate.getTime() -
+ this.connectorsStatus.get(connectorId).startDate.getTime()
+ )}`
);
while (this.connectorsStatus.get(connectorId).start === true) {
if (new Date() > this.connectorsStatus.get(connectorId).stopDate) {
}
if (this.chargingStation.isInAcceptedState() === false) {
logger.error(
- this.logPrefix(connectorId) +
- ' entered in transaction loop while the charging station is not in accepted state'
+ `${this.logPrefix(
+ connectorId
+ )} entered in transaction loop while the charging station is not in accepted state`
);
this.stopConnector(connectorId);
break;
}
if (this.chargingStation.isChargingStationAvailable() === false) {
logger.info(
- this.logPrefix(connectorId) +
- ' entered in transaction loop while the charging station is unavailable'
+ `${this.logPrefix(
+ connectorId
+ )} entered in transaction loop while the charging station is unavailable`
);
this.stopConnector(connectorId);
break;
this.configuration.minDelayBetweenTwoTransactions
) * 1000;
logger.info(
- this.logPrefix(connectorId) + ' waiting for ' + Utils.formatDurationMilliSeconds(wait)
+ `${this.logPrefix(connectorId)} waiting for ${Utils.formatDurationMilliSeconds(wait)}`
);
await Utils.sleep(wait);
const start = Utils.secureRandom();
Utils.getRandomInteger(this.configuration.maxDuration, this.configuration.minDuration) *
1000;
logger.info(
- this.logPrefix(connectorId) +
- ' transaction ' +
- this.chargingStation.getConnectorStatus(connectorId).transactionId.toString() +
- ' started and will stop in ' +
- Utils.formatDurationMilliSeconds(waitTrxEnd)
+ `${this.logPrefix(connectorId)} transaction ${this.chargingStation
+ .getConnectorStatus(connectorId)
+ .transactionId.toString()} started and will stop in ${Utils.formatDurationMilliSeconds(
+ waitTrxEnd
+ )}`
);
await Utils.sleep(waitTrxEnd);
// Stop transaction
logger.info(
- this.logPrefix(connectorId) +
- ' stop transaction ' +
- this.chargingStation.getConnectorStatus(connectorId).transactionId.toString()
+ `${this.logPrefix(connectorId)} stop transaction ${this.chargingStation
+ .getConnectorStatus(connectorId)
+ .transactionId.toString()}`
);
await this.stopTransaction(connectorId);
}
this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions++;
this.connectorsStatus.get(connectorId).skippedTransactions++;
logger.info(
- this.logPrefix(connectorId) +
- ' skipped consecutively ' +
- this.connectorsStatus.get(connectorId).skippedConsecutiveTransactions.toString() +
- '/' +
- this.connectorsStatus.get(connectorId).skippedTransactions.toString() +
- ' transaction(s)'
+ `${this.logPrefix(connectorId)} skipped consecutively ${this.connectorsStatus
+ .get(connectorId)
+ .skippedConsecutiveTransactions.toString()}/${this.connectorsStatus
+ .get(connectorId)
+ .skippedTransactions.toString()} transaction(s)`
);
}
this.connectorsStatus.get(connectorId).lastRunDate = new Date();
}
this.connectorsStatus.get(connectorId).stoppedDate = new Date();
logger.info(
- this.logPrefix(connectorId) +
- ' stopped on connector and lasted for ' +
- Utils.formatDurationMilliSeconds(
- this.connectorsStatus.get(connectorId).stoppedDate.getTime() -
- this.connectorsStatus.get(connectorId).startDate.getTime()
- )
+ `${this.logPrefix(
+ connectorId
+ )} stopped on connector and lasted for ${Utils.formatDurationMilliSeconds(
+ this.connectorsStatus.get(connectorId).stoppedDate.getTime() -
+ this.connectorsStatus.get(connectorId).startDate.getTime()
+ )}`
);
logger.debug(
`${this.logPrefix(connectorId)} connector status: %j`,
const transactionId = this.chargingStation.getConnectorStatus(connectorId).transactionId;
logger.warn(
`${this.logPrefix(connectorId)} stopping a not started transaction${
- transactionId ? ' ' + transactionId.toString() : ''
+ transactionId ? ` ${transactionId.toString()}` : ''
}`
);
}
if (startResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
this.connectorsStatus.get(connectorId).acceptedStartTransactionRequests++;
} else {
- logger.warn(this.logPrefix(connectorId) + ' start transaction rejected');
+ logger.warn(`${this.logPrefix(connectorId)} start transaction rejected`);
this.connectorsStatus.get(connectorId).rejectedStartTransactionRequests++;
}
}
this.workerScript = path.join(
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'),
'charging-station',
- 'ChargingStationWorker' + path.extname(fileURLToPath(import.meta.url))
+ `ChargingStationWorker${path.extname(fileURLToPath(import.meta.url))}`
);
this.initialize();
Configuration.getUIServer().enabled === true &&
} catch (error) {
console.error(
chalk.red(
- 'Error at starting charging station with template file ' +
- stationTemplateUrl.file +
- ': '
+ `Error at starting charging station with template file ${stationTemplateUrl.file}: `
),
error
);
private get wsConnectionUrl(): URL {
return new URL(
- (this.getSupervisionUrlOcppConfiguration()
- ? ChargingStationConfigurationUtils.getConfigurationKey(
- this,
- this.getSupervisionUrlOcppKey()
- ).value
- : this.configuredSupervisionUrl.href) +
- '/' +
- this.stationInfo.chargingStationId
+ `${
+ this.getSupervisionUrlOcppConfiguration()
+ ? ChargingStationConfigurationUtils.getConfigurationKey(
+ this,
+ this.getSupervisionUrlOcppKey()
+ ).value
+ : this.configuredSupervisionUrl.href
+ }/${this.stationInfo.chargingStationId}`
);
}
});
}, this.getHeartbeatInterval());
logger.info(
- this.logPrefix() +
- ' Heartbeat started every ' +
- Utils.formatDurationMilliSeconds(this.getHeartbeatInterval())
+ `${this.logPrefix()} Heartbeat started every ${Utils.formatDurationMilliSeconds(
+ this.getHeartbeatInterval()
+ )}`
);
} else if (this.heartbeatSetInterval) {
logger.info(
- this.logPrefix() +
- ' Heartbeat already started every ' +
- Utils.formatDurationMilliSeconds(this.getHeartbeatInterval())
+ `${this.logPrefix()} Heartbeat already started every ${Utils.formatDurationMilliSeconds(
+ this.getHeartbeatInterval()
+ )}`
);
} else {
logger.error(
case OCPPVersion.VERSION_16:
case OCPPVersion.VERSION_20:
case OCPPVersion.VERSION_201:
- protocol = 'ocpp' + ocppVersion;
+ protocol = `ocpp${ocppVersion}`;
break;
default:
this.handleUnsupportedVersion(ocppVersion);
private initialize(): void {
this.configurationFile = path.join(
path.dirname(this.templateFile.replace('station-templates', 'configurations')),
- ChargingStationUtils.getHashId(this.index, this.getTemplateFromFile()) + '.json'
+ `${ChargingStationUtils.getHashId(this.index, this.getTemplateFromFile())}.json`
);
this.stationInfo = this.getStationInfo();
this.saveStationInfo();
}
private onPing(): void {
- logger.debug(this.logPrefix() + ' Received a WS ping (rfc6455) from the server');
+ logger.debug(`${this.logPrefix()} Received a WS ping (rfc6455) from the server`);
}
private onPong(): void {
- logger.debug(this.logPrefix() + ' Received a WS pong (rfc6455) from the server');
+ logger.debug(`${this.logPrefix()} Received a WS pong (rfc6455) from the server`);
}
private onError(error: WSError): void {
this.closeWSConnection();
- logger.error(this.logPrefix() + ' WebSocket error:', error);
+ logger.error(`${this.logPrefix()} WebSocket error:`, error);
}
private getEnergyActiveImportRegister(connectorStatus: ConnectorStatus, rounded = false): number {
}
}, webSocketPingInterval * 1000);
logger.info(
- this.logPrefix() +
- ' WebSocket ping started every ' +
- Utils.formatDurationSeconds(webSocketPingInterval)
+ `${this.logPrefix()} WebSocket ping started every ${Utils.formatDurationSeconds(
+ webSocketPingInterval
+ )}`
);
} else if (this.webSocketPingSetInterval) {
logger.info(
- this.logPrefix() +
- ' WebSocket ping already started every ' +
- Utils.formatDurationSeconds(webSocketPingInterval)
+ `${this.logPrefix()} WebSocket ping already started every ${Utils.formatDurationSeconds(
+ webSocketPingInterval
+ )}`
);
} else {
logger.error(
);
await Utils.sleep(reconnectDelay);
logger.error(
- this.logPrefix() + ' WebSocket connection retry #' + this.autoReconnectRetryCount.toString()
+ `${this.logPrefix()} WebSocket connection retry #${this.autoReconnectRetryCount.toString()}`
);
this.openWSConnection(
{ ...(this.stationInfo?.wsOptions ?? {}), handshakeTimeout: reconnectTimeout },
// In case of multiple instances: add instance index to charging station id
const instanceIndex = process.env.CF_INSTANCE_INDEX ?? 0;
const idSuffix = stationTemplate.nameSuffix ?? '';
- const idStr = '000000000' + index.toString();
+ const idStr = `000000000${index.toString()}`;
return stationTemplate?.fixedName
? stationTemplate.baseName
- : stationTemplate.baseName +
- '-' +
- instanceIndex.toString() +
- idStr.substring(idStr.length - 4) +
- idSuffix;
+ : `${stationTemplate.baseName}-${instanceIndex.toString()}${idStr.substring(
+ idStr.length - 4
+ )}${idSuffix}`;
}
public static getHashId(index: number, stationTemplate: ChargingStationTemplate): string {
if (!Utils.isUndefined(template[key])) {
logger.warn(
`${logPrefix} Deprecated template key '${key}' usage in file '${templateFile}'${
- logMsgToAppend && '. ' + logMsgToAppend
+ logMsgToAppend && `. ${logMsgToAppend}`
}`
);
}
protected validateMessageEvent(messageEvent: MessageEvent): MessageEvent | false {
if (Array.isArray(messageEvent.data) === false) {
logger.error(
- this.logPrefix(moduleName, 'validateMessageEvent') +
- ' Worker broadcast channel protocol message event data is not an array'
+ `${this.logPrefix(
+ moduleName,
+ 'validateMessageEvent'
+ )} Worker broadcast channel protocol message event data is not an array`
);
return false;
}
if (Utils.validateUUID(messageEvent.data[0]) === false) {
logger.error(
- this.logPrefix(moduleName, 'validateMessageEvent') +
- ' Worker broadcast channel protocol message event data UUID field is invalid'
+ `${this.logPrefix(
+ moduleName,
+ 'validateMessageEvent'
+ )} Worker broadcast channel protocol message event data UUID field is invalid`
);
return false;
}
...args: any[]
) => Promise<void>,
chargingStation,
- (commandPayload.type + 'Reset') as OCPP16StopTransactionReason
+ `${commandPayload.type}Reset` as OCPP16StopTransactionReason
)
.catch(() => {
/* This is intentional */
}
if (connectorId === 0) {
logger.error(
- chargingStation.logPrefix() + ' Trying to unlock connector Id ' + connectorId.toString()
+ `${chargingStation.logPrefix()} Trying to unlock connector Id ${connectorId.toString()}`
);
return OCPPConstants.OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED;
}
): Promise<GenericResponse> {
const transactionConnectorId = commandPayload.connectorId;
if (chargingStation.connectors.has(transactionConnectorId) === true) {
- const remoteStartTransactionLogMsg =
- chargingStation.logPrefix() +
- ' Transaction remotely STARTED on ' +
- chargingStation.stationInfo.chargingStationId +
- '#' +
- transactionConnectorId.toString() +
- " for idTag '" +
- commandPayload.idTag +
- "'";
+ const remoteStartTransactionLogMsg = `${chargingStation.logPrefix()} Transaction remotely STARTED on ${
+ chargingStation.stationInfo.chargingStationId
+ }#${transactionConnectorId.toString()} for idTag '${commandPayload.idTag}'`;
await chargingStation.ocppRequestService.requestHandler<
OCPP16StatusNotificationRequest,
OCPP16StatusNotificationResponse
chargingStation.getConnectorStatus(connectorId).status = OCPP16ChargePointStatus.AVAILABLE;
}
logger.warn(
- chargingStation.logPrefix() +
- ' Remote starting transaction REJECTED on connector Id ' +
- connectorId.toString() +
- ", idTag '" +
- idTag +
- "', availability '" +
- chargingStation.getConnectorStatus(connectorId).availability +
- "', status '" +
- chargingStation.getConnectorStatus(connectorId).status +
- "'"
+ `${chargingStation.logPrefix()} Remote starting transaction REJECTED on connector Id ${connectorId.toString()}, idTag '${idTag}', availability '${
+ chargingStation.getConnectorStatus(connectorId).availability
+ }', status '${chargingStation.getConnectorStatus(connectorId).status}'`
);
return OCPPConstants.OCPP_RESPONSE_REJECTED;
}
}
}
logger.warn(
- chargingStation.logPrefix() +
- ' Trying to remote stop a non existing transaction ' +
- transactionId.toString()
+ `${chargingStation.logPrefix()} Trying to remote stop a non existing transaction ${transactionId.toString()}`
);
return OCPPConstants.OCPP_RESPONSE_REJECTED;
}
.readdirSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../'))
.filter((file) => file.endsWith('.log'))
.map((file) => path.join('./', file));
- const diagnosticsArchive = chargingStation.stationInfo.chargingStationId + '_logs.tar.gz';
+ const diagnosticsArchive = `${chargingStation.stationInfo.chargingStationId}_logs.tar.gz`;
tar.create({ gzip: true }, logFiles).pipe(fs.createWriteStream(diagnosticsArchive));
ftpClient = new Client();
const accessResponse = await ftpClient.access({
throw new OCPPError(
ErrorType.GENERIC_ERROR,
`Diagnostics transfer failed with error code ${accessResponse.code.toString()}${
- uploadResponse?.code && '|' + uploadResponse?.code.toString()
+ uploadResponse?.code && `|${uploadResponse?.code.toString()}`
}`,
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS
);
throw new OCPPError(
ErrorType.GENERIC_ERROR,
`Diagnostics transfer failed with error code ${accessResponse.code.toString()}${
- uploadResponse?.code && '|' + uploadResponse?.code.toString()
+ uploadResponse?.code && `|${uploadResponse?.code.toString()}`
}`,
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS
);
: logger.info(logMsg);
} else {
logger.error(
- chargingStation.logPrefix() +
- ' Charging station boot notification response received: %j with undefined registration status',
+ `${chargingStation.logPrefix()} Charging station boot notification response received: %j with undefined registration status`,
payload
);
}
break;
}
}
- const isAuthorizeConnectorIdDefined = authorizeConnectorId !== undefined;
+ const authorizeConnectorIdDefined = authorizeConnectorId !== undefined;
if (payload.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) {
- isAuthorizeConnectorIdDefined &&
+ authorizeConnectorIdDefined &&
(chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = true);
logger.debug(
`${chargingStation.logPrefix()} IdTag '${requestPayload.idTag}' accepted${
- isAuthorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}` : ''
+ authorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}` : ''
}`
);
} else {
- if (isAuthorizeConnectorIdDefined) {
+ if (authorizeConnectorIdDefined) {
chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = false;
delete chargingStation.getConnectorStatus(authorizeConnectorId).authorizeIdTag;
}
logger.debug(
`${chargingStation.logPrefix()} IdTag '${requestPayload.idTag}' rejected with status '${
payload.idTagInfo.status
- }'${isAuthorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}` : ''}`
+ }'${authorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}` : ''}`
);
}
}
}
if (!transactionConnectorId) {
logger.error(
- chargingStation.logPrefix() +
- ' Trying to start a transaction on a non existing connector Id ' +
- connectorId.toString()
+ `${chargingStation.logPrefix()} Trying to start a transaction on a non existing connector Id ${connectorId.toString()}`
);
return;
}
chargingStation.getConnectorStatus(connectorId).idTagLocalAuthorized === false
) {
logger.error(
- chargingStation.logPrefix() +
- ' Trying to start a transaction with a not local authorized idTag ' +
- chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag +
- ' on connector Id ' +
- connectorId.toString()
+ `${chargingStation.logPrefix()} Trying to start a transaction with a not local authorized idTag ${
+ chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag
+ } on connector Id ${connectorId.toString()}`
);
await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
return;
chargingStation.getConnectorStatus(connectorId).idTagAuthorized === false
) {
logger.error(
- chargingStation.logPrefix() +
- ' Trying to start a transaction with a not authorized idTag ' +
- chargingStation.getConnectorStatus(connectorId).authorizeIdTag +
- ' on connector Id ' +
- connectorId.toString()
+ `${chargingStation.logPrefix()} Trying to start a transaction with a not authorized idTag ${
+ chargingStation.getConnectorStatus(connectorId).authorizeIdTag
+ } on connector Id ${connectorId.toString()}`
);
await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
return;
chargingStation.getConnectorStatus(connectorId).authorizeIdTag !== requestPayload.idTag
) {
logger.error(
- chargingStation.logPrefix() +
- ' Trying to start a transaction with an idTag ' +
- requestPayload.idTag +
- ' different from the authorize request one ' +
- chargingStation.getConnectorStatus(connectorId).authorizeIdTag +
- ' on connector Id ' +
- connectorId.toString()
+ `${chargingStation.logPrefix()} Trying to start a transaction with an idTag ${
+ requestPayload.idTag
+ } different from the authorize request one ${
+ chargingStation.getConnectorStatus(connectorId).authorizeIdTag
+ } on connector Id ${connectorId.toString()}`
);
await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
return;
chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag !== requestPayload.idTag
) {
logger.error(
- chargingStation.logPrefix() +
- ' Trying to start a transaction with an idTag ' +
- requestPayload.idTag +
- ' different from the local authorized one ' +
- chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag +
- ' on connector Id ' +
- connectorId.toString()
+ `${chargingStation.logPrefix()} Trying to start a transaction with an idTag ${
+ requestPayload.idTag
+ } different from the local authorized one ${
+ chargingStation.getConnectorStatus(connectorId).localAuthorizeIdTag
+ } on connector Id ${connectorId.toString()}`
);
await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
return;
}
if (chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
logger.debug(
- chargingStation.logPrefix() +
- ' Trying to start a transaction on an already used connector ' +
- connectorId.toString() +
- ': %j',
+ `${chargingStation.logPrefix()} Trying to start a transaction on an already used connector ${connectorId.toString()}: %j`,
chargingStation.getConnectorStatus(connectorId)
);
return;
});
chargingStation.getConnectorStatus(connectorId).status = OCPP16ChargePointStatus.CHARGING;
logger.info(
- chargingStation.logPrefix() +
- ' Transaction ' +
- payload.transactionId.toString() +
- ' STARTED on ' +
- chargingStation.stationInfo.chargingStationId +
- '#' +
- connectorId.toString() +
- " for idTag '" +
- requestPayload.idTag +
- "'"
+ `${chargingStation.logPrefix()} Transaction ${payload.transactionId.toString()} STARTED on ${
+ chargingStation.stationInfo.chargingStationId
+ }#${connectorId.toString()} for idTag '${requestPayload.idTag}'`
);
if (chargingStation.stationInfo.powerSharedByConnectors) {
chargingStation.powerDivider++;
);
} else {
logger.warn(
- chargingStation.logPrefix() +
- ' Starting transaction id ' +
- payload.transactionId.toString() +
- " REJECTED with status '" +
- payload.idTagInfo?.status +
- "', idTag '" +
- requestPayload.idTag +
- "'"
+ `${chargingStation.logPrefix()} Starting transaction id ${payload.transactionId.toString()} REJECTED with status '${
+ payload.idTagInfo?.status
+ }', idTag '${requestPayload.idTag}'`
);
await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
}
);
if (!transactionConnectorId) {
logger.error(
- chargingStation.logPrefix() +
- ' Trying to stop a non existing transaction ' +
- requestPayload.transactionId.toString()
+ `${chargingStation.logPrefix()} Trying to stop a non existing transaction ${requestPayload.transactionId.toString()}`
);
return;
}
: logger.info(logMsg);
} else {
logger.error(
- chargingStation.logPrefix() +
- ' Charging station boot notification response received: %j with undefined registration status',
+ `${chargingStation.logPrefix()} Charging station boot notification response received: %j with undefined registration status`,
payload
);
}
this.logStatistics();
}, Configuration.getLogStatisticsInterval() * 1000);
logger.info(
- this.logPrefix() +
- ' logged every ' +
- Utils.formatDurationSeconds(Configuration.getLogStatisticsInterval())
+ `${this.logPrefix()} logged every ${Utils.formatDurationSeconds(
+ Configuration.getLogStatisticsInterval()
+ )}`
);
} else {
logger.info(
- this.logPrefix() +
- ' log interval is set to ' +
- Configuration.getLogStatisticsInterval().toString() +
- '. Not logging statistics'
+ `${this.logPrefix()} log interval is set to ${Configuration.getLogStatisticsInterval().toString()}. Not logging statistics`
);
}
}
) {
console.error(
chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage in section '${sectionName}'${
- logMsgToAppend && '. ' + logMsgToAppend
+ logMsgToAppend && `. ${logMsgToAppend}`
}}`
);
} else if (!Configuration.isUndefined(Configuration.getConfig()[key])) {
console.error(
chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${
- logMsgToAppend && '. ' + logMsgToAppend
+ logMsgToAppend && `. ${logMsgToAppend}`
}}`
);
}
let secondsStr = seconds.toString();
if (hours < 10) {
- hoursStr = '0' + hours.toString();
+ hoursStr = `0${hours.toString()}`;
}
if (minutes < 10) {
- minutesStr = '0' + minutes.toString();
+ minutesStr = `0${minutes.toString()}`;
}
if (seconds < 10) {
- secondsStr = '0' + seconds.toString();
+ secondsStr = `0${seconds.toString()}`;
}
- return hoursStr + ':' + minutesStr + ':' + secondsStr.substring(0, 6);
+ return `${hoursStr}:${minutesStr}:${secondsStr.substring(0, 6)}`;
}
public static formatDurationSeconds(duration: number): string {
const response = JSON.parse(messageEvent.data) as ProtocolResponse;
if (Array.isArray(response) === false) {
- throw new Error('Response not an array: ' + JSON.stringify(response, null, 2));
+ throw new Error(`Response not an array: ${JSON.stringify(response, null, 2)}`);
}
const [uuid, responsePayload] = response;
}
this.deleteResponseHandler(uuid);
} else {
- throw new Error('Not a response to a request: ' + JSON.stringify(response, null, 2));
+ throw new Error(`Not a response to a request: ${JSON.stringify(response, null, 2)}`);
}
}
}