<< Prev        Next >>

ID : 516

Error Processing Routine

If an error level 1 occurs within the task, the system can jump into an error processing routine without generating an error.

"Error processing routine" refers to a set of processes executed when an error level 1 occurs within a procedure.

Always attach a label to an error processing routine.

Within the error processing routine, an error that occurred in the "Err object" is stored and properties of the error can be obtained.

Sub ErrTest()
    On Error GoTo RecoverErr
    Dim aaa As Position
    Dim bbb As Joint
    Dim ccc As String

    aaa = P(1000000, 0, 0, 0, 0, 0, -1)  'A position out of the motion space
    bbb = P2J(aaa)

    'Other Statements

    Exit Sub
    
RecoverErr:   'Error processing routine
    bbb = CurJnt
    ccc = "&h" & Hex(Err.Number) & ":" & Err.Description
    PrintMsg "Not put into the variable bbb. CurJnt is put temporarily." & Chr(13) & ccc
    Resume Next
End Sub

Related Items

Err.Number, Err.Description, Err.Source, On Error, On Error Resume Next, Resume, Resume Next

ID : 516

<< Prev        Next >>