Erf$ Function
Returns the name of the function in which the error occurred.
Syntax
Erf$[(taskNumber)]
Parameters
- taskNumber
- Specify the task number as an integer from 0 to 32. Task number omission or “0” specifies the current task.
Return Values
The name of the function where the last error occurred.
Description
Erf$ is used with OnErr. Erf$ returns the function name in which the error occurred. Using Erf$ combined with Err, Ert, Erl and Era the user can determine much more about the error which occurred.
When the event “Error during Auto Mode” occurs, normal task and NoPause task in AUTO mode stop execution and end the task. If the target task has already ended when using this function for NoEmgAbort task or background task, “Error 2261” is occurred. Use OnErr to acquire information before the task ends.
See Also
Era, Erl, Err, ErrMsg$, Ert, OnErr, Trap
Erf$ Function Example
The Following items are returned in the program example below.
- In which task the error occurred (Ert function)
- In which function the error occurred (Erf$ function)
- Where the error occurred (Erl function)
- On which joint the error occurred (Era function)
Function main
OnErr Goto eHandler
Do
Call PickPlace
Loop
Exit Function
eHandler:
Print "The Error code is ", Err
Print "The Error Message is ", ErrMsg$(Err)
errTask = Ert
If errTask > 0 Then
Print "Task number in which error occurred is ", errTask
Print "Function at which error occurred is ", Erf$(errTask)
Print "The line where the error occurred is Line ", Erl(errTask)
If Era(errTask) > 0 Then
Print "Joint which caused the error is ", Era(errTask)
EndIf
EndIf
Fend