refactor: improve OCPP error defaults and usage
[e-mobility-charging-stations-simulator.git] / src / charging-station / broadcast-channel / ChargingStationWorkerBroadcastChannel.ts
index fff823c09b22989f441c6b88968018a6acc933a6..a8d9b045abde5b93728ab16548a3a4e91fec8511 100644 (file)
@@ -194,7 +194,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
                   requestPayload!.connectorId!,
                   this.chargingStation.getConnectorStatus(requestPayload!.connectorId!)!
                     .transactionId!,
-                  configuredMeterValueSampleInterval
+                  configuredMeterValueSampleInterval !== undefined
                     ? secondsToMilliseconds(convertToInt(configuredMeterValueSampleInterval.value))
                     : Constants.DEFAULT_METER_VALUES_INTERVAL,
                 ),
@@ -293,8 +293,8 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
         command,
         requestPayload,
         commandResponse: commandResponse as CommandResponse,
-        errorMessage: (error as Error).message,
-        errorStack: (error as Error).stack,
+        errorMessage: (error as OCPPError).message,
+        errorStack: (error as OCPPError).stack,
         errorDetails: (error as OCPPError).details,
       };
     } finally {