Simplify child registration error handling
This commit is contained in:
@@ -79,6 +79,11 @@ class Machine {
|
||||
|
||||
/*------------------- Register child events -------------------*/
|
||||
registerChild(child, softwareType) {
|
||||
if(!child) {
|
||||
this.logger.error(`Invalid ${softwareType} child provided.`);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (softwareType) {
|
||||
case "measurement":
|
||||
this.logger.debug(`Registering measurement child...`);
|
||||
@@ -95,11 +100,6 @@ class Machine {
|
||||
}
|
||||
|
||||
_connectMeasurement(measurementChild) {
|
||||
if (!measurementChild) {
|
||||
this.logger.error("Invalid measurement provided.");
|
||||
return;
|
||||
}
|
||||
|
||||
const position = measurementChild.config.functionality.positionVsParent;
|
||||
const distance = measurementChild.config.functionality.distanceVsParent || 0;
|
||||
const measurementType = measurementChild.config.asset.type;
|
||||
@@ -137,11 +137,6 @@ class Machine {
|
||||
}
|
||||
|
||||
_connectReactor(reactorChild) {
|
||||
if (!reactorChild) {
|
||||
this.logger.error("Invalid measurement provided.");
|
||||
return;
|
||||
}
|
||||
|
||||
this.downstreamReactor = reactorChild; // downstream from the pumps perpective
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user