Adding email config and notifications for errors
This commit is contained in:
1 parent
1059106fc2
commit
b225123d1f
2 files changed
+23
-1
No files matched your search
@@ -30,6 +30,7 @@ process.on('exit', function (code) {
|
||||
});
|
||||
|
||||
global.USER_PROFILE = {};
|
||||
global.EMAIL_CONFIG = {};
|
||||
|
||||
readStoragePermissions();
|
||||
|
||||
@@ -57,7 +58,7 @@ function readStoragePermissions() {
|
||||
|
||||
global.USER_PROFILE.storagePermissions = permissionsMap;
|
||||
|
||||
readExchangeAPIKey();
|
||||
readEmailConfiguration();
|
||||
}
|
||||
catch (err) {
|
||||
console.log("[ERROR] readStoragePermissions -> err = " + err.message);
|
||||
@@ -65,6 +66,23 @@ function readStoragePermissions() {
|
||||
}
|
||||
}
|
||||
|
||||
function readEmailConfiguration() {
|
||||
|
||||
let filePath;
|
||||
|
||||
try {
|
||||
let fs = require('fs');
|
||||
filePath = '../' + 'Email-Config' + '/' + 'Email.Config.json';
|
||||
global.EMAIL_CONFIG = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
|
||||
readExchangeAPIKey();
|
||||
}
|
||||
catch (err) {
|
||||
console.log("[ERROR] readEmailConfiguration -> err = " + err.message);
|
||||
console.log("[HINT] You need to have a file at this path -> " + filePath);
|
||||
}
|
||||
}
|
||||
|
||||
function readExchangeAPIKey() {
|
||||
|
||||
try {
|
||||
|
||||
@@ -851,6 +851,7 @@
|
||||
clearTimeout(nextLoopTimeoutHandle);
|
||||
clearTimeout(checkLoopHealthHandle);
|
||||
bot.enableCheckLoopHealth = false;
|
||||
assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -863,6 +864,7 @@
|
||||
clearTimeout(nextLoopTimeoutHandle);
|
||||
clearTimeout(checkLoopHealthHandle);
|
||||
bot.enableCheckLoopHealth = false;
|
||||
assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -875,6 +877,7 @@
|
||||
clearTimeout(nextLoopTimeoutHandle);
|
||||
clearTimeout(checkLoopHealthHandle);
|
||||
bot.enableCheckLoopHealth = false;
|
||||
assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true);
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
@@ -886,6 +889,7 @@
|
||||
clearTimeout(nextLoopTimeoutHandle);
|
||||
clearTimeout(checkLoopHealthHandle);
|
||||
bot.enableCheckLoopHealth = false;
|
||||
assistant.sendEmail("FAIL", "Operation Failed. Aborting the process. err = " + err.message, true);
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user