
PRO
dbeard
USA
Asked
— Edited
Is there a method to capture an error in a script but keep processing ? Right now I get an error and the script stops, I would like it to ignore the error and keep going.
Once the error is found you could place this symbol at the front of the command and rerun the script: #
I don't want to comment out the command. Sometimes it is a valid error, but I still want to continue with the script.
This thinking is like telling someone to climb a ladder that is missing a rung. Its very difficult to do. Its the same for a script, as it processes in order. If one of the rungs is missing in the code as a result of an error, its hard to make the next step.
@MazeHorizonTech
Actually, "on-error" commands are common across many scripting and development environments, and most include either a "log and continue", or "ignore and continue" option.
EZ-Script doesn't currently have this capability, but it would not be rocket science for DJ to add it if there were enough demand to push it up to the top of the wish list.
I think most of us have simple enough scripting needs that anyone wanting that advanced capability would be directed towards using a plugin or SDK instead, but I can never predict when DJ will decide something is easy enough to add as a feature, although it is usually right after I describe or create a workaround....
Alan
Can you give me an example?
For me specifically it has to do with Nest. The script below works.
ControlCommand("Nest",RunOnce) say("The temperature of the house is " + $nest_temp_f + " degrees")
It does update the variables. But it errors out as see below and the script stops.
So if I could continue running the script even though I get the error below, I could read the Nest information.
Start 3: ControlCommand("Nest",RunOnce) > Error on line 3: Object reference not set to an instance of an object. Done (00:00:00.4531280)
Years ago I used to program a Palm top computer called a Psion... It had a basic like programming language that used trap errors commands, or onerr goto statements... So below if there is an error generated between onerr(skip) and the :skip label the code would immediately jump to the label skip... If there were no errors the code would ignore the onerr(skip) command...
dbeard - what you're asking for is the Nest control to have the error resolved