initializeExchangeAPI debugged
This commit is contained in:
1 parent
14575a74db
commit
b8c69bb74c
4 files changed
+32
-9
No files matched your search
Binary file not shown.
+5
-1
@@ -1,4 +1,4 @@
|
||||
exports.newContext = function newContext(BOT, DEBUG_MODULE, FILE_STORAGE) {
|
||||
exports.newContext = function newContext(BOT, DEBUG_MODULE, FILE_STORAGE, UTILITIES) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
|
||||
@@ -60,6 +60,10 @@
|
||||
logger.fileName = MODULE_NAME;
|
||||
logger.bot = bot;
|
||||
|
||||
/* Utilities needed. */
|
||||
|
||||
let utilities = UTILITIES.newUtilities(bot);
|
||||
|
||||
/* Storage account to be used here. */
|
||||
|
||||
let cloudStorage = FILE_STORAGE.newAzureFileStorage(bot);
|
||||
|
||||
+5
-1
@@ -1,4 +1,4 @@
|
||||
exports.newDatasource = function newDatasource(BOT, DEBUG_MODULE, FILE_STORAGE) {
|
||||
exports.newDatasource = function newDatasource(BOT, DEBUG_MODULE, FILE_STORAGE, UTILITIES) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
let oliviaAzureFileStorage = FILE_STORAGE.newAzureFileStorage(bot);
|
||||
let tomAzureFileStorage = FILE_STORAGE.newAzureFileStorage(bot);
|
||||
|
||||
/* Utilities needed. */
|
||||
|
||||
let utilities = UTILITIES.newUtilities(bot);
|
||||
|
||||
return thisObject;
|
||||
|
||||
function initialize(callBackFunction) {
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loop -> initializeContext -> Entering function."); }
|
||||
|
||||
context = CONTEXT.newContext(bot, DEBUG_MODULE, AZURE_FILE_STORAGE);
|
||||
context = CONTEXT.newContext(bot, DEBUG_MODULE, AZURE_FILE_STORAGE, UTILITIES);
|
||||
context.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loop -> initializeDatasource -> Entering function."); }
|
||||
|
||||
datasource = DATASOURCE.newDatasource(bot, DEBUG_MODULE, AZURE_FILE_STORAGE);
|
||||
datasource = DATASOURCE.newDatasource(bot, DEBUG_MODULE, AZURE_FILE_STORAGE, UTILITIES);
|
||||
datasource.initialize(onInizialized);
|
||||
|
||||
function onInizialized(err) {
|
||||
@@ -186,11 +186,26 @@
|
||||
|
||||
function onInizialized(err) {
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
initializeUserBot();
|
||||
} else {
|
||||
logger.write("[ERROR] run -> loop -> initializeAssistant -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
switch (err.result) {
|
||||
case global.DEFAULT_OK_RESPONSE.result: {
|
||||
logger.write("[INFO] run -> loop -> initializeAssistant -> onInizialized > Execution finished well. :-)");
|
||||
initializeUserBot();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case global.DEFAULT_RETRY_RESPONSE.result: { // Something bad happened, but if we retry in a while it might go through the next time.
|
||||
logger.write("[ERROR] run -> loop -> initializeAssistant -> onInizialized > Retry Later. Requesting Execution Retry.");
|
||||
nextWaitTime = 'Retry';
|
||||
loopControl(nextWaitTime);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
|
||||
logger.write("[ERROR] run -> loop -> initializeAssistant -> onInizialized > Operation Failed. Aborting the process.");
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user