- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
- let commandResponse: CommandResponse | void
- try {
- commandResponse = await this.commandHandler(command, requestPayload)
- if (commandResponse == null || isEmptyObject(commandResponse)) {
+ this.commandHandler(command, requestPayload)
+ .then(commandResponse => {
+ if (commandResponse == null || isEmptyObject(commandResponse)) {
+ responsePayload = {
+ hashId: this.chargingStation.stationInfo?.hashId,
+ status: ResponseStatus.SUCCESS
+ }
+ } else {
+ responsePayload = this.commandResponseToResponsePayload(
+ command,
+ requestPayload,
+ commandResponse
+ )
+ }
+ })
+ .catch(error => {
+ logger.error(
+ `${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: Handle request error:`,
+ error
+ )