Checking the parameter list for errors
Host On-Demand does not check the parameter list for errors until
the end user plays the macro. When the end user plays the macro, if Host On-Demand finds
an error in the parameter list, then Host On-Demand:
- Terminates the macro playback.
- Generates an error message, either by displaying an error dialog box for the end user or by writing a message to the Java console.
Host On-Demand checks for three types of error situations:
- The specified variable does not exist in the
macro.
In this type of error the parameter list includes a variable name that does not exist in the macro or that is spelled incorrectly (for example, strLocalfile instead of strLocalFile).
Actions that you can take to avoid this type of problem are as follows:- Warn end users that variable names must be spelled correctly; or
- In the main toolbar, create a customized button that plays the macro with the correct parameter list.
- A syntax error exists in the parameter list.
In this type of error the parameter list contains a syntax error (for example, the value is not enclosed in double quotes).
Actions that you can take to avoid this type of problem are as follows:- Warn end users that syntax rules must be observed; or
- In the main toolbar, create a customized button that plays the macro with the correct parameter list.
Figure 1 gives examples of syntax errors and describes how Host On-Demand processes the errors:Figure 1. Examples of syntax errorsstrRemoteFile="NewData.123 intLength="14622"Host On-Demand : 1) Sets the variable strRemoteFile to "NewData.123 intLength=". 2) Tries to process 14622" but cannot (Host On-Demand is looking for a variable name but instead finds an integer followed by a double quote). 3) Terminates the macro playback and generates an error message. strRemoteFile="NewData.123"98 strLocalFile="MyData.123"Host On-Demand : 1) Sets the variable strRemoteFile to "NewData.123". 2) Tries to process 98 but cannot (Host On-Demand is looking for a variable name but finds an integer). 3) Terminates the macro playback and generates an error message. strRemoteFile=NewData.123 strLocalFile=MyData.123Host On-Demand : 1) Does not find a double quote after the first equals sign (=). 2) Terminates the macro playback and generates an error message.
- A run-time error occurs.
An example of a problem in a parameter list that causes a run-time error is the following:
In the example above the variable intLength is of type integer. Host On-Demand tries to convert the string abc to a decimal integer and fails.intLength="abc"
When a run-time error occurs, Host On-Demand:- Terminates the macro playback.
- Displays an error dialog box containing the error message.
In the above example of a run-time error, Host On-Demand displays an error dialog box containing a message such as the following: A type mismatch occurred while updating variable $intLength$.