diff --git a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-errors-053-ts-lf-trading-bot-error-annoucement-condition-evaluation-error.json b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-errors-053-ts-lf-trading-bot-error-announcement-condition-evaluation-error.json similarity index 97% rename from Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-errors-053-ts-lf-trading-bot-error-annoucement-condition-evaluation-error.json rename to Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-errors-053-ts-lf-trading-bot-error-announcement-condition-evaluation-error.json index 74423f81b..86b22deac 100644 --- a/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-errors-053-ts-lf-trading-bot-error-annoucement-condition-evaluation-error.json +++ b/Projects/Superalgos/Schemas/Docs-Topics/ts-lf-trading-bot-errors-053-ts-lf-trading-bot-error-announcement-condition-evaluation-error.json @@ -1,7 +1,7 @@ { "topic": "TS LF Trading Bot Errors", "pageNumber": 53, - "type": "TS LF Trading Bot Error - Annoucement Condition Evaluation Error", + "type": "TS LF Trading Bot Error - Announcement Condition Evaluation Error", "definition": { "text": "While evaluation an Announcement Condition code, the system encountered an error at the code you provided for that condition. ", "updated": 1611733294584 diff --git a/Projects/Superalgos/TS/Bot-Modules/API-Data-Fetcher-Bot/FetchingProcess.js b/Projects/Superalgos/TS/Bot-Modules/API-Data-Fetcher-Bot/FetchingProcess.js index c03a6898e..a7a1601d6 100644 --- a/Projects/Superalgos/TS/Bot-Modules/API-Data-Fetcher-Bot/FetchingProcess.js +++ b/Projects/Superalgos/TS/Bot-Modules/API-Data-Fetcher-Bot/FetchingProcess.js @@ -15,6 +15,23 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) { function initialize(pStatusDependencies, callBackFunction) { try { + + const message = 'Announcement Condition Evaluation Error' + let err = { + message: message + } + let docs = { + project: 'Superalgos', + category: 'Topic', + type: 'TS LF Trading Bot Error - ' + message, + placeholder: {} + } + + TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, undefined, undefined, undefined, undefined, undefined) + err.docs = docs + err.node = TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex] + + throw (err) statusDependencies = pStatusDependencies; callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_OK_RESPONSE); } catch (err) { @@ -196,7 +213,7 @@ exports.newSuperalgosBotModulesFetchingProcess = function (processIndex) { if (endpointNode === undefined) { // TODO ERROR HANDLING. console.log("API Endpoint counld not be found. Check that the at least one Record Property has an API Response Field Reference child, and that this one is referencing an API Response Field.") - throw("Cant continue") + throw ("Cant continue") } } diff --git a/Projects/Superalgos/TS/Function-Libraries/ProcessFunctions.js b/Projects/Superalgos/TS/Function-Libraries/ProcessFunctions.js index 80e93d9e1..83e75eb07 100644 --- a/Projects/Superalgos/TS/Function-Libraries/ProcessFunctions.js +++ b/Projects/Superalgos/TS/Function-Libraries/ProcessFunctions.js @@ -24,44 +24,61 @@ exports.newSuperalgosFunctionLibrariesProcessFunctions = function () { /* If the process is finishing with an error, we report it to the UI and return to the process caller with a FAIL. + + If the docs object was created by an inner module, we will take it and + use it, otherwise we will consider this is a process level error and + we will generate the docs object right here. */ - let docs = { - project: 'Superalgos', - category: 'Topic', - type: 'TS Process Error - Unexpected Error', - placeholder: {} - } + if (error.docs !== undefined) { - if (error.message !== undefined) { - docs.placeholder.errorMessage = { - style: 'Error', - text: error.message + TS.projects.superalgos.functionLibraries.processFunctions.processError + ( + TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_KEY, + error.node, + error.message, + error.docs + ) + + } else { + let docs = { + project: 'Superalgos', + category: 'Topic', + type: 'TS Process Error - Unexpected Error', + placeholder: {} } - } - if (error.stack !== undefined) { - docs.placeholder.errorStack = { - style: 'Javascript', - text: error.stack + + if (error.message !== undefined) { + docs.placeholder.errorMessage = { + style: 'Error', + text: error.message + } } - } - if (error.code !== undefined) { - docs.placeholder.errorCode = { + if (error.stack !== undefined) { + docs.placeholder.errorStack = { + style: 'Javascript', + text: error.stack + } + } + if (error.code !== undefined) { + docs.placeholder.errorCode = { + style: 'Json', + text: error.code + } + } + docs.placeholder.errorDetails = { style: 'Json', - text: error.code + text: JSON.stringify(error, undefined, 4) } - } - docs.placeholder.errorDetails = { - style: 'Json', - text: JSON.stringify(error, undefined, 4) - } - TS.projects.superalgos.functionLibraries.processFunctions.processError - ( - TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_KEY, - undefined, - "An unexpected error caused the Process to stop.", - docs - ) + TS.projects.superalgos.functionLibraries.processFunctions.processError + ( + TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).PROCESS_KEY, + undefined, + "An unexpected error caused the Process to stop.", + docs + ) + + } callBackFunction(TS.projects.superalgos.globals.standardResponses.DEFAULT_FAIL_RESPONSE) } else {