a question on error-handling in API
Hi,
for a target freshly created, the attempt to read the target's robotconfiguration property arises an "No configuration" error, and goes to my error-handling code. Is there any way to detect this so that it won't go to the errorr-handling code? I tried IsEmpty, and a few other Is.. functions in vB in vain.
Thank you very much.
John
Comments
-
Hi
What you could do is something like thisOn Error Resume Next
Dim t as Target
Set t = ActiveStation.Targets("your target")
if t.RobotConfiguration.Cf1 = null then
' Do the error handling
End IfPer Svensson
Robotics and Vision Specialist
Consat Engineering0 -
Hi, thank you very much for your reply.
I may not make myself understood. My code would be like this:
On Error Goto HandleError
...
If t.RobotConfiguration.cf1 = null Then
... do stuff ...
Else
... do other stuff ...
End If
...
HandleError:
... Error handling code ...
When executing the "If t.RobotConfiguration.cf1 = null Then", it immediately goes to the error handling routine below. I have also tried " if IsNull(t.RobotConfiguration) then ", and the same thing happened.
It looks like any reference to t.RobotConfiguration in any fashion leads to an error, while I am trying to find a API or VB function to acheive the logic structure similar to the above code.
0 -
Hi
The difference is that instead of jumping to the error handler you define that if there is an error you continue with the next instruction
On Error Resume Nextinstead of
On Error Goto HandleError
You can also turn off or change how the error handler should behave during program execution.
Per Svensson
Robotics and Vision Specialist
Consat Engineering0 -
Got it. Thank you very much.0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 800 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings