X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPRequestService.ts;h=68338670aa1c4dd710ec1310568328e7d13dd198;hb=83e00df1c1ba02de8b637ca4cb0464eb909ebb18;hp=653679e9b9e5b3452bcf508dc8a2be886022ff51;hpb=dc9226673d5ecd265b970af3f748838017bba6fb;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 653679e9..68338670 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -37,6 +37,7 @@ export default abstract class OCPPRequestService { this.ajv = new Ajv(); ajvFormats(this.ajv); this.requestHandler.bind(this); + this.sendMessage.bind(this); this.sendResponse.bind(this); this.sendError.bind(this); this.internalSendMessage.bind(this); @@ -71,7 +72,7 @@ export default abstract class OCPPRequestService { ); } catch (error) { this.handleSendMessageError(chargingStation, commandName, error as Error, { - throwError: false, + throwError: true, }); } } @@ -116,9 +117,7 @@ export default abstract class OCPPRequestService { params ); } catch (error) { - this.handleSendMessageError(chargingStation, commandName, error as Error, { - throwError: false, - }); + this.handleSendMessageError(chargingStation, commandName, error as Error); } } @@ -364,10 +363,10 @@ export default abstract class OCPPRequestService { chargingStation: ChargingStation, commandName: RequestCommand | IncomingRequestCommand, error: Error, - params: HandleErrorParams = { throwError: true } + params: HandleErrorParams = { throwError: false } ): void { logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error); - if (params?.throwError) { + if (params?.throwError === true) { throw error; } }