Handling errors for Modify and Describe methods in JavaScript

In all environments, including JavaScript, no runtime error occurs when Describe and Modify try to access invalid controls or properties in the DataWindow object. The validity of the argument string is evaluated before the controls are accessed.

Modify

When the string that specifies the control and property to be accessed is invalid, Modify returns an error string, instead of the expected value, such as:

Line 1 Column 12: incorrect syntax.

You can use the error message to figure out what part of the string is incorrect. This is most useful when you are testing your scripts. The error message, which names the line and column number after which the string was not recognized, may not be helpful after your application is deployed.

Describe

When the string for Describe has an unrecognized property, Describe’s return value ends with an exclamation point (!). It will return as many values as it recognizes up to the incorrect one.

When you specify a valid property but that property doesn’t have a value (either because it hasn’t been set or because its value is an expression that can’t be evaluated), Describe returns a question mark (?) for that property. The property’s actual value is null.

NoteAlways check for errors You should include error-checking code that checks for these return values. Other errors can occur later if you depend on settings that failed to take effect.

For more information

For more information on syntax and usage, see Describe and Modify in Chapter 9, “Methods for the DataWindow Control.”