Example: Error Handling

This example demonstrates how you can display a standard error message. Error handling should be added to each workflow script that you write, because errors that are not detected by the workflow code can cause the user's browser to crash.

The user-defined function PrintError receives the name of the calling procedure as a parameter. If an error has occurred, PrintError prints out the error number, description and severity, and the name of the procedure in which the error occurred.

You do not need to create an Err object, because it is intrinsic to VBScript. For details about the Err object, refer to the Microsoft documentation.

The following code segment illustrates how you can add error handling to your subroutines.

Sub <sub_name>()  
        On Error Resume Next
        [Your code here]
        PrintError "<sub_name>"
End Sub