|See Also||error , help , halt , stop|
errortrapfunction enables a program written in O-Matrix to translate an O-Matrix error message to something more useful to the person running a particular O-Matrix program.
If trap is not present in the call to
errortrap, error trapping is turned off and the normal O-Matrix error dialog is used.
)Sets up the function trap as the transfer point if and when an error occurs. If an error occurs after a call of this form, all active function calls are aborted, all active include files are aborted, and the trap function is called with the parameters described below:
)The argument topic is a character row vector containing the O-Matrix help topic that corresponds to the help button in the normal error dialog. The argument msg is a character matrix containing the message that the normal dialog would display.
Suppose that the file TEMP.DAT contains the following text
ExtraInformation = novalue
function trap(topic, msg) begin
If you enter the error handler above and then enter
1 2 3 4
5 6 ; 8
O-Matrix will print the following in the Command window
ExtraInformation = "Reading input data file:"
read("TEMP.DAT", "int", 2, 4)
(the line numbers will be different). You can restore normal error processing by entering:
Reading input data file:
read: invalid character for int type
Line 2 File C:\OMWIN\TEMP.DAT
Executing at or below line 22 in file
20 errortrap(function trap)
21 ExtraInformation = "Reading input data file:"
-> read("TEMP.DAT", "int", 2, 4)