UI Server: dedupe some code in helpers
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16RequestService.ts
index 69ff5c851f61f142b7c31438e89896e9424a024d..a0f09bb8336d76ce442b88e26056829a0e63c12e 100644 (file)
@@ -140,6 +140,8 @@ export default class OCPP16RequestService extends OCPPRequestService {
         ) as JSONSchemaType<OCPP16StopTransactionRequest>,
       ],
     ]);
+    this.buildRequestPayload.bind(this);
+    this.validatePayload.bind(this);
   }
 
   public async requestHandler<Request extends JsonType, Response extends JsonType>(
@@ -165,7 +167,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
     }
     throw new OCPPError(
       ErrorType.NOT_SUPPORTED,
-      `${moduleName}.requestHandler: Unsupported OCPP command '${commandName}'`,
+      `Unsupported OCPP command '${commandName}'`,
       commandName,
       commandParams
     );
@@ -261,7 +263,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
         throw new OCPPError(
           ErrorType.NOT_SUPPORTED,
           // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-          `${moduleName}.buildRequestPayload: Unsupported OCPP command '${commandName}'`,
+          `Unsupported OCPP command '${commandName}'`,
           commandName,
           commandParams
         );