Throw an error in the template does not have default required mesurand
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16IncomingRequestService.ts
index 8f86f478c7aba1c4507b02edd6ab0ac5838edfe8..5b94ece886b900710d4085b6e075cde1871b00e2 100644 (file)
@@ -43,9 +43,9 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
       }
     } else {
       // Throw exception
-      const errMsg = `${commandName} is not implemented to handle payload ${JSON.stringify(commandPayload, null, 2)}`;
-      await this.chargingStation.ocppRequestService.sendError(messageId, new OCPPError(ErrorType.NOT_IMPLEMENTED, errMsg), commandName);
-      throw new OCPPError(ErrorType.NOT_IMPLEMENTED, errMsg);
+      const error = new OCPPError(ErrorType.NOT_IMPLEMENTED, `${commandName} is not implemented to handle payload ${JSON.stringify(commandPayload, null, 2)}`);
+      await this.chargingStation.ocppRequestService.sendError(messageId, error, commandName);
+      throw error;
     }
     // Send the built response
     await this.chargingStation.ocppRequestService.sendMessage(messageId, response, MessageType.CALL_RESULT_MESSAGE, commandName);