X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FAuthorizedTagsCache.ts;h=a3c8e5cdc42c7bfc1f9e978bb59067f856783fd3;hb=acda9cab8724c9b51d1f5f9a8a12c6dd3617ff55;hp=8c95660d07130155f495ec3d1fa7d017dbab1ca6;hpb=130783a74f495abcb198b7f01abe19dab4f7fb47;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/AuthorizedTagsCache.ts b/src/charging-station/AuthorizedTagsCache.ts index 8c95660d..a3c8e5cd 100644 --- a/src/charging-station/AuthorizedTagsCache.ts +++ b/src/charging-station/AuthorizedTagsCache.ts @@ -30,12 +30,12 @@ export default class AuthorizedTagsCache { this.FSWatchers.set( file, FileUtils.watchJsonFile( - this.logPrefix(file), - FileType.Authorization, file, - null, + FileType.Authorization, + this.logPrefix(file), + undefined, (event, filename) => { - if (!Utils.isEmptyString(filename) && event === 'change') { + if (Utils.isNotEmptyString(filename) && event === 'change') { try { logger.debug( `${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload` @@ -44,10 +44,10 @@ export default class AuthorizedTagsCache { this.deleteFSWatcher(file); } catch (error) { FileUtils.handleFileException( - this.logPrefix(file), - FileType.Authorization, file, + FileType.Authorization, error as NodeJS.ErrnoException, + this.logPrefix(file), { throwError: false, } @@ -94,10 +94,10 @@ export default class AuthorizedTagsCache { authorizedTags = JSON.parse(fs.readFileSync(file, 'utf8')) as string[]; } catch (error) { FileUtils.handleFileException( - this.logPrefix(file), - FileType.Authorization, file, - error as NodeJS.ErrnoException + FileType.Authorization, + error as NodeJS.ErrnoException, + this.logPrefix(file) ); } } else { @@ -106,7 +106,7 @@ export default class AuthorizedTagsCache { return authorizedTags; } - private logPrefix(file: string): string { + private logPrefix = (file: string): string => { return Utils.logPrefix(` Authorized tags cache for authorization file '${file}' |`); - } + }; }