Asked — Edited

Error Handling

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.


ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

#1  

Once the error is found you could place this symbol at the front of the command and rerun the script: #

PRO
USA
#2  

I don't want to comment out the command. Sometimes it is a valid error, but I still want to continue with the script.

#3  

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.

#4  

@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

PRO
Synthiam
#5  

Can you give me an example?

PRO
USA
#6  

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)

#7  

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...


onerr(skip)
sayezb("I am a robot")
print("Hello")
#blah, blah
:skip

PRO
Synthiam
#8  

dbeard - what you're asking for is the Nest control to have the error resolved

PRO
USA
#9  

True. But since I never got a response from that request, I was trying to do a workaround on my own. But it appears we don't do error handling with scripts, so I am SOL. Will keep trying to find another way to get the data.

PRO
Synthiam
#10  

Fixes are scheduled and do not happen over night. A release of a software package with well over a million lines of code requires significant effort and scheduled - the Nest control will be reviewed at the next release. There are no plans to implement an error handling function in ez-script. As this conversation has demonstrated, all example usages of error handling are incorrect. There is no applicable usage for EZ-Script error handling if correct code is written, which is the purpose of ez-robot, to teach programming and robotics.:)

Stay tuned for a future release that will contain the fix if an issue is identified. There has still not been an issue identified and all Nest tests at ezrobot function correctly.