RAISE and ERROR from TRAP ROUTINE
I am trying to raise an error from a TRAP routine, I achieve this when in the upper routine the error is handled in this way:
ERROR(MY_ERROR)
.....ACTIONS...
However, when I have more than one error handled and I have to handle it this way:
ERROR
IF ERRNO=MY_ERROR THEN
I get that the error is not controlled. I don't know what to do.
The trap routine is handled like this:
TRAP t_trap_Empty
RAISE err_empty_stop;
ERROR
RAISE;
ENDTRAP
Thank you very much!!!
0
Answers
-
The error which has occurred might not be what you expect it to be. I recommend changing from IF THEN to a TEST CASE. Include a default and stop the program execution. Then you can view the value stored in the system ERRNO and compare it to find the actual error at that time.Lee Justice0
-
lemster68 said:The error which has occurred might not be what you expect it to be. I recommend changing from IF THEN to a TEST CASE. Include a default and stop the program execution. Then you can view the value stored in the system ERRNO and compare it to find the actual error at that time.0
-
Here is one:
ERROR TEST ERRNO CASE erNumFault: TPWrite astNumFault{1}; TPWrite "The program number received was: "\Num:=nProgramNumber; TPReadFK nDummy,"Press EXIT to exit:","","","","Exit",""; EXIT; DEFAULT: TPErase; TPReadFK nDummy,"Handshaking was unsuccessful. Press EXIT to exit:","","","","Exit",""; EXIT; ENDTEST
I often put a placeholder for an instruction in the default <SMT>. This will cause an execution error, which WILL bring attention to the pendant. At this point one would view the ERRNUM datatype, find the value in ERRNO, and then find the corresponding predefined errors to find that which matches. Then you will know exactly what the error was. I highly recommend doing it this way because there are times when an error that you NEVER anticipated has occurred.
Lee Justice0
Categories
- All Categories
- 5.5K RobotStudio
- 394 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 309 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings