X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FIdTagsCache.ts;h=890ac1fbf12892a04c7afcde3e27d04f09845154;hb=a679a1625e2f153a4c882bc8ff7befce50d4119a;hp=fd35fa8baaecca49d58924ef6d970a2da0672558;hpb=4c8782eeb15a7c41b4ef5a413768abd47615047a;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/IdTagsCache.ts b/src/charging-station/IdTagsCache.ts index fd35fa8b..890ac1fb 100644 --- a/src/charging-station/IdTagsCache.ts +++ b/src/charging-station/IdTagsCache.ts @@ -3,7 +3,7 @@ import fs from 'node:fs'; import type { ChargingStation } from './ChargingStation'; import { ChargingStationUtils } from './ChargingStationUtils'; import { FileType, IdTagDistribution } from '../types'; -import { ErrorUtils, FileUtils, Utils, logger } from '../utils'; +import { Utils, handleFileException, logger, watchJsonFile } from '../utils'; type IdTagsCacheValueType = { idTags: string[]; @@ -116,7 +116,7 @@ export class IdTagsCache { private setIdTagsCache(file: string, idTags: string[]) { return this.idTagsCaches.set(file, { idTags, - idTagsFileWatcher: FileUtils.watchJsonFile( + idTagsFileWatcher: watchJsonFile( file, FileType.Authorization, this.logPrefix(file), @@ -130,7 +130,7 @@ export class IdTagsCache { this.deleteIdTagsCache(file); this.deleteIdTagsCacheIndexes(file); } catch (error) { - ErrorUtils.handleFileException( + handleFileException( file, FileType.Authorization, error as NodeJS.ErrnoException, @@ -172,7 +172,7 @@ export class IdTagsCache { try { return JSON.parse(fs.readFileSync(file, 'utf8')) as string[]; } catch (error) { - ErrorUtils.handleFileException( + handleFileException( file, FileType.Authorization, error as NodeJS.ErrnoException,