refactor: cleanup default params in error handlers
[e-mobility-charging-stations-simulator.git] / src / performance / storage / Storage.ts
index aee3ae9efbb5ca86b17a8a7ddf3fcd01b7b80684..39d0a1b30250b80fd825351f4d476792ef89a3a6 100644 (file)
@@ -9,7 +9,7 @@ import {
   type Statistics,
   StorageType
 } from '../../types/index.js'
-import { logger, setDefaultErrorParams } from '../../utils/index.js'
+import { logger } from '../../utils/index.js'
 
 export abstract class Storage {
   protected readonly storageUri: URL
@@ -22,13 +22,22 @@ export abstract class Storage {
     this.logPrefix = logPrefix
   }
 
-  protected handleDBError (
+  protected handleDBStorageError (
     type: StorageType,
     error: Error,
     table?: string,
-    params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false }
+    params: HandleErrorParams<EmptyObject> = {
+      throwError: false,
+      consoleOut: false
+    }
   ): void {
-    setDefaultErrorParams(params, { throwError: false, consoleOut: false })
+    params = {
+      ...{
+        throwError: false,
+        consoleOut: false
+      },
+      ...params
+    }
     const inTableOrCollectionStr = table != null && ` in table or collection '${table}'`
     logger.error(
       `${this.logPrefix} ${this.getDBNameFromStorageType(type)} error '${