X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fperformance%2Fstorage%2FStorageFactory.ts;h=cecaa48901bf3689475503d431891edd9e41c518;hb=2ed9c7a844dd0ff83236dab693c18d2fad046310;hp=741b16316320563a2eb9bd70612e46fa204fb68a;hpb=edd134392e237a3242dc2093341df70244c51472;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/storage/StorageFactory.ts b/src/performance/storage/StorageFactory.ts index 741b1631..cecaa489 100644 --- a/src/performance/storage/StorageFactory.ts +++ b/src/performance/storage/StorageFactory.ts @@ -1,10 +1,12 @@ // 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; }