repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Permit to run code in async scope in the OCPP stack
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ocpp
/
OCPPRequestService.ts
diff --git
a/src/charging-station/ocpp/OCPPRequestService.ts
b/src/charging-station/ocpp/OCPPRequestService.ts
index 625e69f99bc025f89b8459418aa32f5c8d52b463..68338670aa1c4dd710ec1310568328e7d13dd198 100644
(file)
--- 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.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);
this.sendResponse.bind(this);
this.sendError.bind(this);
this.internalSendMessage.bind(this);
@@
-70,7
+71,9
@@
export default abstract class OCPPRequestService {
commandName
);
} catch (error) {
commandName
);
} catch (error) {
- this.handleRequestError(chargingStation, commandName, error as Error);
+ this.handleSendMessageError(chargingStation, commandName, error as Error, {
+ throwError: true,
+ });
}
}
}
}
@@
-90,7
+93,7
@@
export default abstract class OCPPRequestService {
commandName
);
} catch (error) {
commandName
);
} catch (error) {
- this.handle
Request
Error(chargingStation, commandName, error as Error);
+ this.handle
SendMessage
Error(chargingStation, commandName, error as Error);
}
}
}
}
@@
-114,7
+117,7
@@
export default abstract class OCPPRequestService {
params
);
} catch (error) {
params
);
} catch (error) {
- this.handle
RequestError(chargingStation, commandName, error as Error, { throwError: false }
);
+ this.handle
SendMessageError(chargingStation, commandName, error as Error
);
}
}
}
}
@@
-356,14
+359,14
@@
export default abstract class OCPPRequestService {
}
}
}
}
- private handle
Request
Error(
+ private handle
SendMessage
Error(
chargingStation: ChargingStation,
commandName: RequestCommand | IncomingRequestCommand,
error: Error,
chargingStation: ChargingStation,
commandName: RequestCommand | IncomingRequestCommand,
error: Error,
- params: HandleErrorParams<EmptyObject> = { throwError:
tru
e }
+ params: HandleErrorParams<EmptyObject> = { throwError:
fals
e }
): void {
logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error);
): void {
logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error);
- if (params?.throwError) {
+ if (params?.throwError
=== true
) {
throw error;
}
}
throw error;
}
}