From 06127450ee7cfc993f67caf521ea595cb0523733 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 21 Feb 2022 21:31:35 +0100 Subject: [PATCH] Refine a bit OCPP services instantiation error message MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts | 2 +- src/charging-station/ocpp/1.6/OCPP16RequestService.ts | 2 +- src/charging-station/ocpp/1.6/OCPP16ResponseService.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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([ -- 2.34.1