cloneObject,
formatDurationMilliSeconds,
handleSendMessageError,
- isNullOrUndefined,
logger
} from '../../utils/index.js'
type Ajv = _Ajv.default
chargingStation.wsConnection?.send(messageToSend, (error?: Error) => {
PerformanceStatistics.endMeasure(commandName, beginId)
clearTimeout(sendTimeout)
- if (isNullOrUndefined(error)) {
+ if (error == null) {
logger.debug(
`${chargingStation.logPrefix()} >> Command '${commandName}' sent ${OCPPServiceUtils.getMessageTypeString(
messageType
// Resolve response
resolve(messagePayload)
}
- } else if (error != null) {
+ } else {
handleSendError(
new OCPPError(
ErrorType.GENERIC_ERROR,
}
throw new OCPPError(
ErrorType.SECURITY_ERROR,
- `Cannot send command ${commandName} PDU when the charging station is in ${chargingStation?.bootNotificationResponse?.status} state on the central server`,
+ `Cannot send command ${commandName} PDU when the charging station is in ${chargingStation.bootNotificationResponse?.status} state on the central server`,
commandName
)
}