From: Jérôme Benoit Date: Mon, 21 Feb 2022 20:31:35 +0000 (+0100) Subject: Refine a bit OCPP services instantiation error message X-Git-Tag: v1.1.48~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=06127450ee7cfc993f67caf521ea595cb0523733;p=e-mobility-charging-stations-simulator.git Refine a bit OCPP services instantiation error message Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index d0d7bf09..9377c605 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -30,7 +30,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer public constructor(chargingStation: ChargingStation) { if (new.target?.name === 'OCPP16IncomingRequestService') { - throw new TypeError('Cannot construct OCPP16IncomingRequestService instances directly'); + throw new TypeError(`Cannot construct ${new.target?.name} instances directly`); } super(chargingStation); this.incomingRequestHandlers = new Map([ diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 0385f45a..8141b29f 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -28,7 +28,7 @@ import logger from '../../../utils/Logger'; export default class OCPP16RequestService extends OCPPRequestService { public constructor(chargingStation: ChargingStation, ocppResponseService: OCPPResponseService) { if (new.target?.name === 'OCPP16RequestService') { - throw new TypeError('Cannot construct OCPP16RequestService instances directly'); + throw new TypeError(`Cannot construct ${new.target?.name} instances directly`); } super(chargingStation, ocppResponseService); } diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index 876cc80b..20255d7d 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -22,7 +22,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { public constructor(chargingStation: ChargingStation) { if (new.target?.name === 'OCPP16ResponseService') { - throw new TypeError('Cannot construct OCPP16ResponseService instances directly'); + throw new TypeError(`Cannot construct ${new.target?.name} instances directly`); } super(chargingStation); this.responseHandlers = new Map([