refactor: cleanup get composite schedule code
[e-mobility-charging-stations-simulator.git] / src / utils / ErrorUtils.ts
index b4f52ba894a9e57891a04954bbe066b6b1d40ad8..fea221e4fc4f371688a1d33960cc7cbd36d6219b 100644 (file)
@@ -1,7 +1,7 @@
 import chalk from 'chalk';
 
 import { logger } from './Logger';
-import { Utils } from './Utils';
+import { isNotEmptyString } from './Utils';
 import type { ChargingStation } from '../charging-station';
 import type {
   EmptyObject,
@@ -34,10 +34,10 @@ export const handleFileException = (
   fileType: FileType,
   error: NodeJS.ErrnoException,
   logPrefix: string,
-  params: HandleErrorParams<EmptyObject> = defaultErrorParams
+  params: HandleErrorParams<EmptyObject> = defaultErrorParams,
 ): void => {
   setDefaultErrorParams(params);
-  const prefix = Utils.isNotEmptyString(logPrefix) ? `${logPrefix} ` : '';
+  const prefix = isNotEmptyString(logPrefix) ? `${logPrefix} ` : '';
   let logMsg: string;
   switch (error.code) {
     case 'ENOENT':
@@ -77,7 +77,7 @@ export const handleSendMessageError = (
   chargingStation: ChargingStation,
   commandName: RequestCommand | IncomingRequestCommand,
   error: Error,
-  params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false }
+  params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false },
 ): void => {
   setDefaultErrorParams(params, { throwError: false, consoleOut: false });
   logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error);
@@ -88,7 +88,7 @@ export const handleSendMessageError = (
 
 export const setDefaultErrorParams = <T extends JsonType>(
   params: HandleErrorParams<T>,
-  defaultParams: HandleErrorParams<T> = defaultErrorParams
+  defaultParams: HandleErrorParams<T> = defaultErrorParams,
 ): HandleErrorParams<T> => {
   params = { ...defaultParams, ...params };
   return params;