Standard Responses to Globals

This commit is contained in:
Luis Fernando Molina committed 2020-11-27 13:17:12 +01:00
1 parent 2ded6a45b1
commit da5e50bf85
36 files changed
+549 -542

No files matched your search

+18 -18
View File
@@ -40,45 +40,45 @@
if (outputDataset.referenceParent !== undefined) {
if (outputDataset.referenceParent.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Dataset Definition not defined. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
if (outputDataset.referenceParent.parentNode !== undefined) {
if (outputDataset.referenceParent.parentNode.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Product not defined. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
if (botNode !== undefined) {
if (botNode.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Bot not defined. Bot = " + JSON.stringify(botNode));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
if (botNode.parentNode !== undefined) {
if (botNode.parentNode.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Data Mine not defined. Data Mine = " + JSON.stringify(botNode.parentNode));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine or Trading Mine. Bot = " + JSON.stringify(botNode));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Product not attached to a Bot. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Dataset Definition not attached to a Product. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Output Dataset with no reference to a Dataset Definition. Output Dataset = " + JSON.stringify(outputDataset));
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
return
}
@@ -99,11 +99,11 @@
}
}
callBackFunction(global.DEFAULT_OK_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE);
} catch (err) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> err = " + err.stack);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
}
@@ -130,38 +130,38 @@
if (outputDataset.referenceParent !== undefined) {
if (outputDataset.referenceParent.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Dataset Definition not defined. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
if (outputDataset.referenceParent.parentNode !== undefined) {
if (outputDataset.referenceParent.parentNode.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Product not defined. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
if (botNode !== undefined) {
if (botNode.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Bot not defined. Bot = " + JSON.stringify(botNode));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
if (botNode.parentNode !== undefined) {
if (botNode.parentNode.config.codeName === undefined) {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> codeName at Mine not defined. Mine = " + JSON.stringify(botNode.parentNode));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Bot not attached to a Data Mine | Trading Mine | Learning Mine. Bot = " + JSON.stringify(botNode));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Product not attached to a Bot. Product = " + JSON.stringify(outputDataset.referenceParent.parentNode));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Dataset Definition not attached to a Product. Dataset Definition = " + JSON.stringify(outputDataset.referenceParent));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
} else {
logger.write(MODULE_NAME, "[ERROR] raiseEvents -> Output Dataset with no reference to a Dataset Definition. Output Dataset = " + JSON.stringify(outputDataset));
throw (global.DEFAULT_FAIL_RESPONSE);
throw (TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE);
}
/* All good, lets emit the event. */