Error handling

This commit is contained in:
Luis Fernando Molina committed 2020-08-28 10:50:32 +02:00
1 parent 304ce8fd50
commit f3faa93a91
2 files changed
+10 -7

No files matched your search

+3
View File
@@ -215,6 +215,9 @@ function newEventsServerClient(networkNode) {
let config = JSON.parse(networkNode.config)
host = config.host
port = config.webSocketsPort
/* Check if we really have to stablish the connection. */
if (config.autoConnect === false) {return}
} catch (err) {
networkNode.payload.uiObject.setErrorMessage('Bad configuration. Cannot know the host name or the webSocketsPort.')
return
+7 -7
View File
@@ -23,6 +23,7 @@ function newUiObject() {
isRunning: undefined,
shortcutKey: undefined,
isShowing: undefined,
hasError: undefined,
run: run,
stop: stop,
heartBeat: heartBeat,
@@ -74,7 +75,6 @@ function newUiObject() {
let isRunningAtBackend
let runningAtBackendCounter = 0
let hasError
let errorMessageCounter = 0
let hasValue
@@ -690,7 +690,7 @@ function newUiObject() {
errorMessageCounter--
if (errorMessageCounter < 0) {
errorMessageCounter = 0
hasError = false
thisObject.hasError = false
}
}
@@ -735,7 +735,7 @@ function newUiObject() {
function setErrorMessage(message, duration) {
if (message !== undefined) {
errorMessage = message
hasError = true
thisObject.hasError = true
if (duration === undefined) { duration = 1 }
errorMessageCounter = 100 * duration
}
@@ -743,7 +743,7 @@ function newUiObject() {
function resetErrorMessage() {
errorMessage = undefined
hasError = false
thisObject.hasError = false
}
function setValue(value, counter, minDecimals) {
@@ -1367,7 +1367,7 @@ function newUiObject() {
}
function drawErrorMessage() {
if (hasError === false) { return }
if (thisObject.hasError === false) { return }
if (canvas.floatingSpace.inMapMode === true) {
return
}
@@ -1713,7 +1713,7 @@ function newUiObject() {
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.BLACK + ', 0.70)'
browserCanvasContext.fill()
/* Border when node is in focus */
if (hasError !== true && nodeDefinition.isHierarchyHead !== true && thisObject.circularProgressBar === undefined) {
if (thisObject.hasError !== true && nodeDefinition.isHierarchyHead !== true && thisObject.circularProgressBar === undefined) {
browserCanvasContext.beginPath()
browserCanvasContext.arc(visiblePosition.x, visiblePosition.y, VISIBLE_RADIUS, 0, Math.PI * 2, true)
browserCanvasContext.closePath()
@@ -1733,7 +1733,7 @@ function newUiObject() {
}
}
if (hasError === true) {
if (thisObject.hasError === true) {
VISIBLE_RADIUS = thisObject.container.frame.radius * 1.5
if (canvas.floatingSpace.inMapMode === true) {
VISIBLE_RADIUS = canvas.floatingSpace.transformRadiusToMap(VISIBLE_RADIUS)