X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPRequestService.ts;h=25c8943564a7f91afc639c22a7f99a0a28d247d9;hb=91a4f151f35933f762d1287754a7463e12989b29;hp=0380e6646402bd801a22ba92ceef19305f01e30b;hpb=9952c548347c27a4006eb765659d7bc05c400260;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 0380e664..25c89435 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,12 +1,12 @@ -import { JSONSchemaType } from 'ajv'; +import type { JSONSchemaType } from 'ajv'; import Ajv from 'ajv-draft-04'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; import PerformanceStatistics from '../../performance/PerformanceStatistics'; -import { EmptyObject } from '../../types/EmptyObject'; -import { HandleErrorParams } from '../../types/Error'; -import { JsonObject, JsonType } from '../../types/JsonType'; +import type { EmptyObject } from '../../types/EmptyObject'; +import type { HandleErrorParams } from '../../types/Error'; +import type { JsonObject, JsonType } from '../../types/JsonType'; import { ErrorType } from '../../types/ocpp/ErrorType'; import { MessageType } from '../../types/ocpp/MessageType'; import { @@ -16,7 +16,7 @@ import { RequestParams, ResponseType, } from '../../types/ocpp/Requests'; -import { ErrorResponse, Response } from '../../types/ocpp/Responses'; +import type { ErrorResponse, Response } from '../../types/ocpp/Responses'; import Constants from '../../utils/Constants'; import logger from '../../utils/Logger'; import Utils from '../../utils/Utils'; @@ -268,10 +268,10 @@ export default abstract class OCPPRequestService { ); } logger.error( - `${chargingStation.logPrefix()} Error %j occurred when calling command %s with message data %j`, - error, - commandName, - messagePayload + `${chargingStation.logPrefix()} Error occurred when calling command ${commandName} with message data ${JSON.stringify( + messagePayload + )}:`, + error ); chargingStation.requests.delete(messageId); reject(error); @@ -361,17 +361,17 @@ export default abstract class OCPPRequestService { error: Error, params: HandleErrorParams = { throwError: true } ): void { - logger.error(chargingStation.logPrefix() + ' Request command %s error: %j', commandName, error); + logger.error(`${chargingStation.logPrefix()} Request command ${commandName} error:`, error); if (params?.throwError) { throw error; } } // eslint-disable-next-line @typescript-eslint/no-unused-vars - public abstract requestHandler( + public abstract requestHandler( chargingStation: ChargingStation, commandName: RequestCommand, commandParams?: JsonType, params?: RequestParams - ): Promise; + ): Promise; }