X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fperformance%2Fstorage%2FStorageFactory.ts;h=cecaa48901bf3689475503d431891edd9e41c518;hb=b3d7d65476a4ab586b3ccd188f0bfbe8452aba0e;hp=b0f9da58cff118cb2cfc5b929ff0b8f6a86abf62;hpb=6c1761d470507ea23d186be61b94ca7375c5144a;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/storage/StorageFactory.ts b/src/performance/storage/StorageFactory.ts index b0f9da58..cecaa489 100644 --- a/src/performance/storage/StorageFactory.ts +++ b/src/performance/storage/StorageFactory.ts @@ -1,10 +1,12 @@ -// Copyright Jerome Benoit. 2021. All Rights Reserved. +// Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import { StorageType } from '../../types/Storage'; import { JsonFileStorage } from './JsonFileStorage'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars import { MikroOrmStorage } from './MikroOrmStorage'; import { MongoDBStorage } from './MongoDBStorage'; import type { Storage } from './Storage'; +import { BaseError } from '../../exception'; +import { StorageType } from '../../types'; export class StorageFactory { private constructor() { @@ -12,7 +14,7 @@ export class StorageFactory { } public static getStorage(type: StorageType, connectionUri: string, logPrefix: string): Storage { - let storageInstance: Storage = null; + let storageInstance: Storage | null = null; switch (type) { case StorageType.JSON_FILE: storageInstance = new JsonFileStorage(connectionUri, logPrefix); @@ -26,7 +28,7 @@ export class StorageFactory { // storageInstance = new MikroOrmStorage(connectionUri, logPrefix, type); // break; default: - throw new Error(`${logPrefix} Unknown storage type: ${type}`); + throw new BaseError(`${logPrefix} Unknown storage type: ${type}`); } return storageInstance; }