X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPServiceUtils.ts;h=078fa0a09551ca56e9e8d66bb94aad9cb2dab92c;hb=022a231c76e227205b0124a7aef8e16ceb86a1d9;hp=c5387f33f9c693f41ff21f1b20d9f40d7c5cd514;hpb=c3da35d496cbb2c78e85fb3d2e125ffd6fd297f4;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index c5387f33..078fa0a0 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -30,7 +30,7 @@ import { type StatusNotificationRequest, type StatusNotificationResponse, } from '../../types'; -import { Constants, ErrorUtils, Utils, logger } from '../../utils'; +import { Utils, handleFileException, logger } from '../../utils'; export class OCPPServiceUtils { protected constructor() { @@ -264,7 +264,7 @@ export class OCPPServiceUtils { try { return JSON.parse(fs.readFileSync(filePath, 'utf8')) as JSONSchemaType; } catch (error) { - ErrorUtils.handleFileException( + handleFileException( filePath, FileType.JsonSchema, error as NodeJS.ErrnoException, @@ -363,8 +363,13 @@ export class OCPPServiceUtils { unitMultiplier: 1, } ): number { - options.limitationEnabled = options?.limitationEnabled ?? true; - options.unitMultiplier = options?.unitMultiplier ?? 1; + options = { + ...{ + limitationEnabled: true, + unitMultiplier: 1, + }, + ...options, + }; const parsedInt = parseInt(value); const numberValue = isNaN(parsedInt) ? Infinity : parsedInt; return options?.limitationEnabled