Rename the project to SAP branding approved name
[e-mobility-charging-stations-simulator.git] / src / performance / storage / Storage.ts
index 2f5feccee9a2e2b888e1a9bfef353ab4ff7d002d..4770fb7520737cf1da7b3c4833761fd9ba9b7344 100644 (file)
@@ -2,6 +2,7 @@
 
 import { DBName, StorageType } from '../../types/Storage';
 
+import { EmptyObject } from '../../types/EmptyObject';
 import { HandleErrorParams } from '../../types/Error';
 import Statistics from '../../types/Statistics';
 import { URL } from 'url';
@@ -18,8 +19,20 @@ export abstract class Storage {
     this.logPrefix = logPrefix;
   }
 
-  protected handleDBError(type: StorageType, error: Error, table?: string, params: HandleErrorParams = { throwError: false }): void {
-    logger.error(`${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${error.message}'${(!Utils.isNullOrUndefined(table) || !table) && ` in table or collection '${table}'`}: %j`, error);
+  protected handleDBError(
+    type: StorageType,
+    error: Error,
+    table?: string,
+    params: HandleErrorParams<EmptyObject> = { throwError: false }
+  ): void {
+    const inTableOrCollectionStr =
+      (!Utils.isNullOrUndefined(table) || !table) && ` in table or collection '${table}'`;
+    logger.error(
+      `${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${
+        error.message
+      }'${inTableOrCollectionStr}: %j`,
+      error
+    );
     if (params?.throwError) {
       throw error;
     }
@@ -40,5 +53,7 @@ export abstract class Storage {
 
   public abstract open(): void | Promise<void>;
   public abstract close(): void | Promise<void>;
-  public abstract storePerformanceStatistics(performanceStatistics: Statistics): void | Promise<void>;
+  public abstract storePerformanceStatistics(
+    performanceStatistics: Statistics
+  ): void | Promise<void>;
 }