Every global subroutine includes an optional parameter called intErrorMode. The intErrorMode parameter allows users to trap errors and to send them to Alarm Services. There are three options for the intErrorMode.
Enter this option... |
To... |
0 |
Use the default error handling. Allows subroutines to provide the error messages. If no entry is made for the intErrorMode parameter, the default is used. |
1 |
Allow the user to handle the error messages. Errors in the subroutines are passed back to the calling routine for handling. |
2 |
Write errors to all Alarm Services. No error messages display. Instead, the errors are written to all iFIX Alarm Services, including the Alarm History window. |
For example, if you use the intErrorMode parameter with the OpenDigitalPoint subroutine, the command would look like:
OpenDigitalPoint [DigitalPoint], [intErrorMode]
Examples
For the OpenPicture subroutine, you get the standard error message if you enter 0 for the intErrorMode, as shown in the following example:
OpenPicture "BadPic", , , , 0
When you use 0 for the intErrorMode, if you try to open a picture that does not exist, a message box appears whose title is the name of the picture that made the erroneous call and whose contents are the error number and error description.
If you enter a 1 for intErrorMode, the error is raised for you to handle:
OpenPicture "BadPic", , , , 1
Your error handling code would have to look something like this:
On Error Goto Errorhandler
OpenPicture "BadPic", , , , 1
End Sub
Errorhandler:
Msgbox "my error message" + Chr(13) + Cstr(Err.Number) + Chr(13) + Err.Description, , Err.Source
If you enter a 2 for intErrorMode, the error is sent to all Alarm Services, including the Alarm History window using the SendOperatorMessage method:
OpenPicture "BadPic", , , , 2
When you use 2 for the intErrorMode, you provide for silent error tracking.