Share this page

# 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.

VBScript example (supported in Desktop Client only)

Copy code

    Sub PrintError(strFunctionName)
            If Err.Number <> 0 Then
                MsgBox "Error #" & Err.Number & ": " & Err.Description, _
                vbOKOnly+vbCritical, _
                "Workflow Error in Function " & strFunctionName
            End If
    End Sub

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

Back to top

https://admhelp.microfocus.com Application Quality Management 8942
Tips to improve your search results... OpenText™ Application Quality Management Help Center OpenText™ Application Quality Management Help Center OpenText™ Application Quality Management Help 26.1 All View Local Help Center View Online Help Center Version: