X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fui-server%2Fui-services%2FAbstractUIService.ts;h=d7595c26db164589e1cfb807812fab72be7a3c0b;hb=f12cf7ef207d1e1b243c45b1eecf5d89d8ec772d;hp=a190b60395e216f8c0a46ec6e6ad1ad0597829f5;hpb=7375968c99fc22707e16e5e7923ca130c824ce5b;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index a190b603..d7595c26 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -162,18 +162,21 @@ export abstract class AbstractUIService { ): void { if (isNotEmptyArray(payload.hashIds)) { payload.hashIds = payload.hashIds - ?.filter((hashId) => !isNullOrUndefined(hashId)) ?.map((hashId) => { if (this.uiServer.chargingStations.has(hashId) === true) { return hashId; } - logger.warn( - `${this.logPrefix( - moduleName, - 'sendBroadcastChannelRequest', - )} Charging station with hashId '${hashId}' not found`, - ); - }) as string[]; + const msg = `${this.logPrefix( + moduleName, + 'sendBroadcastChannelRequest', + )} Charging station with hashId '${hashId}' not found`; + if (payload.hashIds?.length === 1) { + throw new BaseError(msg); + } else { + logger.warn(msg); + } + }) + ?.filter((hashId) => !isNullOrUndefined(hashId)) as string[]; } const expectedNumberOfResponses = isNotEmptyArray(payload.hashIds) ? payload.hashIds!.length