MotionBASIC
TM
Error Handler
Modifying Your Program
ON ERROR GOTO YOUR.LABEL
Will disarm the MBTools error handler
and arm a new error handler routine
identified by the label "YOUR.LABEL".
ON ERROR GOTO 0
Will disable error handling completely.
Any subsequent faults or errors will
stop the program.
5.4 Application Specific Error Traps
Your application may have specific errors or faults that you want to handle
outside the MBTools error handler. Typically, these would be faults that are not
critical and you would want to warn the operator and present a choice of
aborting the operation or continuing.
To trap an application specific error you must create a subroutine using the
label APPL.ERR.TRAP: This subroutine is called by the ERR.HDLR routine
unless the error is a range error in data input statement and MENU.BAS is
present.
NOTE......
The Error Handler module will always call the APPL.ERR.TRAP subroutine
whenever a fault or error occurs. If your application does not need any
application specific error trapping, you must add the following line to your
program:
APPL.ERR.TRAP: :RETURN
When your application does need application specific error trapping, the
APPL.ERR.TRAP should do the following:
1.
Test ERR, FAULT@, etc. to determine if the error is one that needs
special handling.
2.
If it is an error you want to trap, take what ever action is needed to
handle the error.
3.
If you want to continue execution of the program, set the variable
RESUME.FLAG=TRUE.
4.
If the error is not one that needs special handling, or if you want the
error handler to shut the machine down, leave the variable
RESUME.FLAG=FALSE.
5.
Return to the error handler using a RETURN statement.
NOTE......
The error handler always sets RESUME.FLAG=FALSE before calling your
APPL.ERR.TRAP subroutine.
Figure 4 shows an example for an application specific error trapping subroutine.
The example traps the occurrence of a software overtravel limit fault while
manually jogging the machine.
GN3-ERRb
page 15
Содержание MotionBASIC
Страница 3: ...ii...
Страница 5: ...MotionBASICTM Error Handler Table of Contents A3 Complete Program Listings 31 iv...
Страница 6: ...v...
Страница 8: ...vii...
Страница 10: ...MotionBASICTM Error Handler Welcome THIS PAGE INTENTIONALLY LEFT BLANK page 2 GN3 ERRb...
Страница 16: ...MotionBASICTM Error Handler Configuring The Module THIS PAGE INTENTIONALLY LEFT BLANK page 8 GN3 ERRb...
Страница 20: ...MotionBASICTM Error Handler Loading The Module THIS PAGE INTENTIONALLY LEFT BLANK page 12 GN3 ERRb...
Страница 26: ...MotionBASICTM Error Handler Modifying Your Program THIS PAGE INTENTIONALLY LEFT BLANK page 18 GN3 ERRb...
Страница 35: ...MotionBASICTM Error Handler Source Code Overview THIS PAGE INTENTIONALLY LEFT BLANK GN3 ERRb page 27...
Страница 37: ...MotionBASICTM Error Handler Appendix A1 GN3 ERRb page 29...
Страница 38: ...MotionBASICTM Error Handler Appendix A1 THIS PAGE INTENTIONALLY LEFT BLANK page 30 GN3 ERRb...
Страница 40: ...MotionBASICTM Error Handler Appendix A2 THIS PAGE INTENTIONALLY LEFT BLANK page 32 GN3 ERRb...