|
LSTERR always equals -1 - Printable Version +- Ewon Technical Forum (https://techforum.ewon.biz) +-- Forum: Development (https://techforum.ewon.biz/forum-50.html) +--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html) +--- Thread: LSTERR always equals -1 (/thread-2058.html) |
LSTERR always equals -1 - Tim_Myth - 13-07-2022 I'm using the code from this post: https://forum.hms-networks.com/t/basic-script-error-handling/67326/13 Code: ONERROR "GOTO ERROR"So far every error number has been -1. This isn't very helpful without knowing what -1 means and if LSTERR is always -1, there's no need to check the value. RE: LSTERR always equals -1 - Jean-Yves - 20-07-2022 Hi, Can you add line in your script, it should solve your issue: SETSYS PRG,"RESUMENEXT",1 RE: LSTERR always equals -1 - Tim_Myth - 20-07-2022 (20-07-2022, 02:58 PM)Jean-Yves Wrote: Hi, I could, but I want to catch and fix errors, not ignore them. I think as a temporary work around I will make a LINENUMBER tag and update it in each line of the function. I already use a CURRENTFUNCTION tag to track which function is running. EG: CURRENTFUNCTION@ ="" LINENUMBER@ = 0 ONERROR "GOTO ERROR: Function MosquittoInit() CURRENFUNCTION@ = "MosquittoInit" LINENUMBER@ = 1 MQTT "open", "ewon_flexy", "test.mosquitto.org" LINENUMBER@ = 2 MQTT "setparam", "log", "1" LINENUMBER@ = 3 MQTT "subscribe", "ewons/test/messages", 0 ENDFN ERROR: error_number% = GETSYS PRG, “LSTERR” LOGEVENT "Error in function " + CURRENTFUNCTION@ + " on line " + LINENUMBER@ + ": " + STR$ error_number%, 80 Some of my functions are dozens of lines long and the entire program.bas is ~1000 lines. RE: LSTERR always equals -1 - Jean-Yves - 20-07-2022 When I use this, the code appears for me, but only once, this is a bug I have reported it to our R&D |