online Warnings and Info
This commit is contained in:
1 parent
5e16b3e49a
commit
3c74c2feea
6 files changed
+101
-66
No files matched your search
+1
-21
@@ -81,9 +81,6 @@
|
||||
try {
|
||||
let fixedTimeLoopIntervalHandle;
|
||||
|
||||
/* Errors sent to the UI */
|
||||
bot.processError = processError
|
||||
|
||||
/* Heartbeats sent to the UI */
|
||||
bot.processHeartBeat = processHeartBeat
|
||||
|
||||
@@ -763,26 +760,9 @@
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Heartbeat', event)
|
||||
}
|
||||
|
||||
function processError(node, errorMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Error', event)
|
||||
}
|
||||
|
||||
function processStopped() {
|
||||
if (global.unexpectedError !== undefined) {
|
||||
processError(undefined, "An unexpected error caused the Process to stop.")
|
||||
global.PROCESS_ERROR(bot.processKey, undefined, "An unexpected error caused the Process to stop.")
|
||||
} else {
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Stopped')
|
||||
}
|
||||
|
||||
+1
-21
@@ -85,9 +85,6 @@
|
||||
try {
|
||||
let fixedTimeLoopIntervalHandle;
|
||||
|
||||
/* Errors sent to the UI */
|
||||
bot.processError = processError
|
||||
|
||||
/* Heartbeats sent to the UI */
|
||||
bot.processHeartBeat = processHeartBeat
|
||||
|
||||
@@ -571,26 +568,9 @@
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Heartbeat', event)
|
||||
}
|
||||
|
||||
function processError(node, errorMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Error', event)
|
||||
}
|
||||
|
||||
function processStopped() {
|
||||
if (global.unexpectedError !== undefined) {
|
||||
processError(undefined, "An unexpected error caused the Process to stop.")
|
||||
global.PROCESS_ERROR(bot.processKey, undefined, "An unexpected error caused the Process to stop.")
|
||||
} else {
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Stopped')
|
||||
}
|
||||
|
||||
+46
-2
@@ -41,8 +41,10 @@
|
||||
global.EVENT_SERVER_CLIENT.listenToEvent(bot.sessionKey, 'Run Session', undefined, bot.sessionKey, undefined, onSessionRan)
|
||||
global.EVENT_SERVER_CLIENT.listenToEvent(bot.sessionKey, 'Stop Session', undefined, bot.sessionKey, undefined, onSessionStopped)
|
||||
|
||||
/* Errors sent to the UI */
|
||||
/* Connect this here so that it is accesible from other places */
|
||||
bot.sessionError = sessionError
|
||||
bot.sessionWarning = sessionWarning
|
||||
bot.sessionInfo = sessionInfo
|
||||
|
||||
/* Heartbeats sent to the UI */
|
||||
bot.sessionHeartBeat = sessionHeartBeat
|
||||
@@ -113,7 +115,7 @@
|
||||
socialBotsModule.sendMessage(bot.SESSION.type + " '" + bot.SESSION.name + "' is stopping " + commandOrigin)
|
||||
socialBotsModule.finalize()
|
||||
bot.STOP_SESSION = true
|
||||
sessionError(bot.SESSION, commandOrigin)
|
||||
sessionInfo(bot.SESSION, commandOrigin)
|
||||
}
|
||||
|
||||
function setUpAppSchema() {
|
||||
@@ -421,6 +423,48 @@
|
||||
}
|
||||
}
|
||||
|
||||
function sessionWarning(node, warningMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
warningMessage: warningMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
warningMessage: warningMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.sessionKey, 'Warning', event)
|
||||
|
||||
if (global.STOP_TASK_GRACEFULLY === true) {
|
||||
bot.STOP_SESSION = true
|
||||
}
|
||||
}
|
||||
|
||||
function sessionInfo(node, infoMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
infoMessage: infoMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
infoMessage: infoMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.sessionKey, 'Info', event)
|
||||
|
||||
if (global.STOP_TASK_GRACEFULLY === true) {
|
||||
bot.STOP_SESSION = true
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> err = " + err.stack);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@
|
||||
function validationFailed(errorInNode, errorMessage) {
|
||||
let nodeString = JSON.stringify(errorInNode)
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> " + errorMessage + ' -> nodeString = ' + nodeString)
|
||||
bot.processError(errorInNode, errorMessage)
|
||||
bot.global.PROCESS_ERROR(bot.processKey, errorInNode, errorMessage)
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
|
||||
|
||||
+1
-21
@@ -45,9 +45,6 @@
|
||||
let fixedTimeLoopIntervalHandle;
|
||||
bot.STOP_SESSION = true;
|
||||
|
||||
/* Errors sent to the UI */
|
||||
bot.processError = processError
|
||||
|
||||
/* Heartbeats sent to the UI */
|
||||
bot.processHeartBeat = processHeartBeat
|
||||
|
||||
@@ -654,26 +651,9 @@
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Heartbeat', event)
|
||||
}
|
||||
|
||||
function processError(node, errorMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Error', event)
|
||||
}
|
||||
|
||||
function processStopped() {
|
||||
if (global.unexpectedError !== undefined) {
|
||||
processError(undefined, "An unexpected error caused the Process to stop.")
|
||||
global.PROCESS_ERROR(bot.processKey, undefined, "An unexpected error caused the Process to stop.")
|
||||
} else {
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(bot.processKey, 'Stopped')
|
||||
}
|
||||
|
||||
@@ -51,6 +51,57 @@ global.REMOVE_TIME = function (datetime) {
|
||||
return new Date(date.getUTCFullYear() + "-" + (date.getUTCMonth() + 1) + "-" + date.getUTCDate() + " " + "00:00" + GMT_SECONDS);
|
||||
}
|
||||
|
||||
global.PROCESS_ERROR = function (processKey, node, errorMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
errorMessage: errorMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(processKey, 'Error', event)
|
||||
}
|
||||
|
||||
global.PROCESS_WARNING = function (processKey, node, warningMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
warningMessage: warningMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
warningMessage: warningMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(processKey, 'Warning', event)
|
||||
}
|
||||
|
||||
global.PROCESS_INFO = function (processKey, node, infoMessage) {
|
||||
let event
|
||||
if (node !== undefined) {
|
||||
event = {
|
||||
nodeName: node.name,
|
||||
nodeType: node.type,
|
||||
nodeId: node.id,
|
||||
infoMessage: infoMessage
|
||||
}
|
||||
} else {
|
||||
event = {
|
||||
infoMessage: infoMessage
|
||||
}
|
||||
}
|
||||
global.EVENT_SERVER_CLIENT.raiseEvent(processKey, 'Info', event)
|
||||
}
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.log('[ERROR] Task Server -> server -> uncaughtException -> err.message = ' + err.message)
|
||||
console.log('[ERROR] Task Server -> server -> uncaughtException -> err.stack = ' + err.stack)
|
||||
|
||||
Reference in new issue
Block a user