I think I’m seeing errors? I made a tag named CURRENTFUNCTION@ and at the start of each function, I set the tag value equal to the function name like this:
FUNCTION MQTTConnectionCheck()
CURRENTFUNCTION@="MQTTCONNECTIONCHECK"
IF MQTT_CONNECTED@=1 THEN
STATUS% = MQTT "STATUS"
MQTT_CONNECTION_STATUS@=STATUS%
IF MQTT_CONNECTION_STATUS@ < 5 THEN
MQTT_MESSAGE_FAIL@=MQTT_MESSAGE_FAIL@+1
IF MQTT_DOWN_ALM_ADMIN@=0 THEN
TSET 4,1500
MQTT_DOWN_ALM_ADMIN@=1
ENDIF
ENDIF
IF MQTT_CONNECTION_STATUS@ = 5 THEN
MQTT_DOWN_ALM_ADMIN@=0
TSET 4,0
ENDIF
ELSE
MQTT_MESSAGE_FAIL@=MQTT_MESSAGE_FAIL@+1
ENDIF
IF MQTT_MESSAGE_FAIL@ >4 THEN
@MQTTConnectRetry()
ENDIF
ENDFN
I also use ONERROR “GOTO ERROR” like I mentioned:
ERROR:
LASTERROR% = GETSYS PRG,"LSTERR"
LOGEVENT "Error in function (" + CURRENTFUNCTION@ + "): " + STR$ LASTERROR%, 80
CLOSE 1
And this appears in my events log:
Error in function (INSIGHTHEARTBEATSET): -1
Error in function (MQTTCONNECTIONCHECK): -1
Error in function (MQTTCONNECTIONCHECK): -1
Error in function (VPNENABLE): -1
When does processing get shunted to the error handler? At the end of the function or when the error occurs? That is, suppose the line “TSET 4,1500” in the MQTTConnectionCheck function throws an error. Does processing continue until “ENDFN” before going to “ERROR:” or does it go immediately to “ERROR:”?