LOTUSSCRIPT/COM/OLE CLASSES


Handling run-time errors
Example

See "File contents" for a list of error messages.

The Domino Designer methods raise run-time errors to flag most conditions. To process errors, you must include an error-handling routine; if you do not, the script exits when an error occurs.

Some methods return a status value or return Nothing as an object handle to flag a condition; in these cases, the return value can be checked before proceeding. Some properties indicate status, and can be checked after calling a method that affects the status value.

For example, you can detect a failure of the New or Open method of NotesDatabase through any of the following indicators:


LotusScript raises run-time errors for many conditions, such as file errors and arithmetic exceptions. You must handle these errors if you do not want the script to exit on an error.

To trap all errors, include an On Error statement without an error number before any executable statements. To trap a specific error, include an On Error statement with the error number before the statement that might cause the error. However, the On Error statements with numbers must follow the On Error statement without a number. For example, if you want to trap the errors lsERR_NOTES_DATABASE_NOTOPEN and ErrObjectVariableNotSet plus any other errors, you need to write the following On Error statements in the following order:

On Error Goto processError
On Error lsERR_NOTES_DATABASE_NOTOPEN Goto _
processErrDatabaseDoesNotExist
On Error ErrObjectVariableNotSet Goto processErrObjectVariableNotSet

The error constants are defined in the following files in the Domino data directory. You must include the appropriate file or files in the (Declarations) event of the object to access the error constants. You can create a script library with the %include statements, and then use that script library in the options section.


Details
Example
See Also