Runtime Errors

A runtime error occurs when a command attempts to perform an action that is invalid. For example, a runtime error occurs if you try to perform a calculation using a variable that has not been initialized.

The conditions that result in runtime errors depends on the language you are scripting with. A condition that might cause a runtime error in VBScript might not cause an error in JScript. For example, attempting to divide by zero results in a runtime error in VBScript, but not in JScript.

If there is a runtime error in a server script and debugging is enabled for that application, the server starts the debugger, which displays an error message:

If a server script contains a runtime error and debugging is not enabled for that application, the error message text will appear in the client browser:

If a runtime error occurs in a client script, you might see an error such as the following when the document is loaded into Microsoft Internet Explorer:

The result of a runtime error is similar to that of a syntax error: if you are debugging on the server, an error message appears in the script debugger on the server. Otherwise, error text appears in the client browser.

Depending on the language you are using, you might be able to include statements in your scripts to trap runtime errors and run your own error procedures. For example, in VBScript, you can use the ON ERROR statement to establish error trapping. For more details, see the documentation for your scripting language.

See Also

Syntax Errors

Logic Errors

Server Script Debugging

Client Script Debugging


© 1997 by Microsoft Corporation. All rights reserved.