Share via


Checking For Errors in Script Component Files

Because Windows® Script Components are used as COM components, they normally run silently. However, while you are developing your script component file, you might find it useful to know about errors in the file. You can specify three types of error checking:

  • Check for XML validity. For details, see Script Component Files and XML Conformance.

  • Allow notification for syntax and run-time errors. By default, if an error occurs in a script component file, a generic error message is displayed. By specifying error notification, you can have the script component parser display details about the error.

  • Allow debugging. By default, you cannot use the script debugger for script components. If you enable debugging, you can launch the script debugger in response to an error, by setting a breakpoint, or with a Stop (Microsoft® Visual Basic® Scripting Edition (VBScript)) or debugger (JScript) statement.

Setting Error Options

Specify error options as attributes of the XML <?component?> processing instruction.

To specify error checking

  • Include the <?component?> processing instruction at the top of the script component file (but after the optional <?XML ?> declaration) with one or more of the following attributes:

    • error    Set this to true to display detailed error messages for syntax or run-time errors in the script component.

    • debug    Set this to true to enable debugging. If this debugging is not enabled, you cannot launch the script debugger for a script component in any way.

For example, the following enables all three error reporting options:

<?component error="true" debug="true"?>

Tip

Turn error reporting off before deploying your script component to a production environment.

See Also

Concepts

Script Component File Contents

Using the Script Component Wizard

Creating Registration Information

Creating a Script Component Type Library

Script Component Files and XML Conformance