Merge pull request #485 from Luis-Fernando-Molina/develop

Contribution: Bug Fixed with Improvement in error handler of Snapshot module
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-01-26 18:33:01 +01:00
commit 4de97a542e
1 file changed
+6 -4
@@ -240,10 +240,11 @@ exports.newSuperalgosBotModulesSnapshots = function (processIndex) {
let value = eval(instruction)
values.push(value)
} catch (err) {
const message = 'Snapshot Unexpected Error'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Error - Snapshot Instruction Evaluation Error',
type: 'TS LF Trading Bot Error - ' + message,
placeholder: {}
}
@@ -252,7 +253,7 @@ exports.newSuperalgosBotModulesSnapshots = function (processIndex) {
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, nodeWithCode.name, nodeWithCode.code, undefined, undefined, contextInfo)
tradingSystem.errors.push([nodeWithCode.id, 'Instruction ' + instruction + ' evalueates with error ' + err.message])
tradingSystem.errors.push([nodeWithCode.id, message, docs])
values.push(0)
}
}
@@ -260,15 +261,16 @@ exports.newSuperalgosBotModulesSnapshots = function (processIndex) {
}
}
} catch (err) {
const message = 'Snapshot Unexpected Error'
let docs = {
project: 'Superalgos',
category: 'Topic',
type: 'TS LF Trading Bot Error - Snapshot Unexpected Error',
type: 'TS LF Trading Bot Error - ' + message,
placeholder: {}
}
TS.projects.superalgos.utilities.docsFunctions.buildPlaceholder(docs, err, nodeWithCode.name, nodeWithCode.code, undefined)
tradingSystem.errors.push([nodeWithCode.id, err.message, docs])
tradingSystem.errors.push([nodeWithCode.id, message, docs])
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] runSimulation -> addCodeToSnapshot -> nodeWithCode.code = ' + nodeWithCode.code)
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME, '[ERROR] runSimulation -> addCodeToSnapshot -> err = ' + err.stack)
}