Error and Exception Handling
All WPD Automation errors are returned as standard JScript exceptions. Script writers are encouraged to wrap script code in try-catch blocks and handle errors appropriately.
Note
For Windows 7, the primary scripting language supported by WPD Automation is JScript 5.6. Other scripting languages, such as VBScript or JScript.NET are not supported.
The following JScript example demonstrates how to wrap script code in a try-catch block to handle errors.
try
{
// Script code here.
}
catch (e)
{
// Handle exception here.
alert("An error has occurred: " + e.description);
}
Related topics