]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor: harmonize errMsg → errorMsg for intra-file naming consistency
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Mar 2026 20:50:43 +0000 (21:50 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Mar 2026 20:50:43 +0000 (21:50 +0100)
OCPPServiceUtils.ts used both errMsg (4x) and errorMsg (1x) for the
same semantic. PerformanceStatistics.ts used errMsg (4x) while the
rest of the codebase uses errorMsg. Align to errorMsg everywhere.

src/charging-station/ocpp/OCPPServiceUtils.ts
src/performance/PerformanceStatistics.ts

index d9d38c926e7ff487cefccfed90dde5b073751070..c47f84592a6ca03432222544b4d4a3f4b40b60b7 100644 (file)
@@ -1253,7 +1253,7 @@ const buildPowerMeasurandValue = (
         )
       break
     default: {
-      const errMsg = `MeterValues measurand ${
+      const errorMsg = `MeterValues measurand ${
         powerTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       }: Unknown ${chargingStation.stationInfo?.currentOutType} currentOutType in template file ${
@@ -1261,8 +1261,8 @@ const buildPowerMeasurandValue = (
       }, cannot calculate ${
         powerTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
       } measurand value`
-      logger.error(`${chargingStation.logPrefix()} ${errMsg}`)
-      throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, RequestCommand.METER_VALUES)
+      logger.error(`${chargingStation.logPrefix()} ${errorMsg}`)
+      throw new OCPPError(ErrorType.INTERNAL_ERROR, errorMsg, RequestCommand.METER_VALUES)
     }
   }
 
@@ -1519,7 +1519,7 @@ const buildCurrentMeasurandValue = (
         : getRandomFloatRounded(connectorMaximumAmperage, connectorMinimumAmperage)
       break
     default: {
-      const errMsg = `MeterValues measurand ${
+      const errorMsg = `MeterValues measurand ${
         currentTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
       }: Unknown ${chargingStation.stationInfo?.currentOutType} currentOutType in template file ${
@@ -1527,8 +1527,8 @@ const buildCurrentMeasurandValue = (
       }, cannot calculate ${
         currentTemplate.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
       } measurand value`
-      logger.error(`${chargingStation.logPrefix()} ${errMsg}`)
-      throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, RequestCommand.METER_VALUES)
+      logger.error(`${chargingStation.logPrefix()} ${errorMsg}`)
+      throw new OCPPError(ErrorType.INTERNAL_ERROR, errorMsg, RequestCommand.METER_VALUES)
     }
   }
 
@@ -1960,17 +1960,17 @@ const checkMeasurandPowerDivider = (
   measurandType: MeterValueMeasurand | undefined
 ): void => {
   if (chargingStation.powerDivider == null) {
-    const errMsg = `MeterValues measurand ${
+    const errorMsg = `MeterValues measurand ${
       measurandType ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
     }: powerDivider is undefined`
-    logger.error(`${chargingStation.logPrefix()} ${errMsg}`)
-    throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, RequestCommand.METER_VALUES)
+    logger.error(`${chargingStation.logPrefix()} ${errorMsg}`)
+    throw new OCPPError(ErrorType.INTERNAL_ERROR, errorMsg, RequestCommand.METER_VALUES)
   } else if (chargingStation.powerDivider <= 0) {
-    const errMsg = `MeterValues measurand ${
+    const errorMsg = `MeterValues measurand ${
       measurandType ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
     }: powerDivider have zero or below value ${chargingStation.powerDivider.toString()}`
-    logger.error(`${chargingStation.logPrefix()} ${errMsg}`)
-    throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, RequestCommand.METER_VALUES)
+    logger.error(`${chargingStation.logPrefix()} ${errorMsg}`)
+    throw new OCPPError(ErrorType.INTERNAL_ERROR, errorMsg, RequestCommand.METER_VALUES)
   }
 }
 
index 008350da93e4f20e4e7d46f48a86fd3d66e43ea8..07439a2978c3a57ad8860f58b85da7bd4ecf6a9f 100644 (file)
@@ -71,9 +71,9 @@ export class PerformanceStatistics {
 
   public static deleteInstance (objId: string | undefined): boolean {
     if (objId == null) {
-      const errMsg = 'Cannot delete performance statistics instance without specifying object id'
-      logger.error(`${PerformanceStatistics.logPrefix()} ${errMsg}`)
-      throw new BaseError(errMsg)
+      const errorMsg = 'Cannot delete performance statistics instance without specifying object id'
+      logger.error(`${PerformanceStatistics.logPrefix()} ${errorMsg}`)
+      throw new BaseError(errorMsg)
     }
     return PerformanceStatistics.instances.delete(objId)
   }
@@ -98,19 +98,19 @@ export class PerformanceStatistics {
     uri: undefined | URL
   ): PerformanceStatistics | undefined {
     if (objId == null) {
-      const errMsg = 'Cannot get performance statistics instance without specifying object id'
-      logger.error(`${PerformanceStatistics.logPrefix()} ${errMsg}`)
-      throw new BaseError(errMsg)
+      const errorMsg = 'Cannot get performance statistics instance without specifying object id'
+      logger.error(`${PerformanceStatistics.logPrefix()} ${errorMsg}`)
+      throw new BaseError(errorMsg)
     }
     if (objName == null) {
-      const errMsg = 'Cannot get performance statistics instance without specifying object name'
-      logger.error(`${PerformanceStatistics.logPrefix()} ${errMsg}`)
-      throw new BaseError(errMsg)
+      const errorMsg = 'Cannot get performance statistics instance without specifying object name'
+      logger.error(`${PerformanceStatistics.logPrefix()} ${errorMsg}`)
+      throw new BaseError(errorMsg)
     }
     if (uri == null) {
-      const errMsg = 'Cannot get performance statistics instance without specifying object uri'
-      logger.error(`${PerformanceStatistics.logPrefix()} ${errMsg}`)
-      throw new BaseError(errMsg)
+      const errorMsg = 'Cannot get performance statistics instance without specifying object uri'
+      logger.error(`${PerformanceStatistics.logPrefix()} ${errorMsg}`)
+      throw new BaseError(errorMsg)
     }
     if (!PerformanceStatistics.instances.has(objId)) {
       PerformanceStatistics.instances.set(objId, new PerformanceStatistics(objId, objName, uri))