Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

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


Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

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.

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

Can you give me an example?
For me specifically it has to do with Nest. The script below works.

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.

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


sayezb("I am a robot")
#blah, blah
dbeard - what you're asking for is the Nest control to have the error resolved
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.
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.