Partager via


Managing Run-Time Errors

Managing Run-Time Errors

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

When the workflow engine sees a negative value in the ErrorNumber Property, it writes an error message to the audit trail. To log a run-time error, set the ErrorNumber Property to a negative value in your script. You can use decimal or hexadecimal notation, such as –2147467259 or &H80004005. The workflow engine gets the message for the error from the ErrorDescription Property. The ErrorDescription Property should contain the string that you want written to the audit trail for the associated error number.

In the following code, if the call to CreateObject fails, the workflow state transition ends. This happens because the ErrorNumber Property gets set to a negative value. The workflow engine generates an entry in the application log of the event viewer with the error message that reads, in part, "State transition error: Error in action: I'm testing this." Note that the rest of the code in the procedure is executed, and any other procedure calls in the current action field are completed.

VBScript

   on error resume next
   Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")
   if err.number <> 0 then
      with WorkflowSession
         .ErrorNumber = &H80004005  ' (-2147467259)
         .ErrorDescription = "I'm testing this..."
      end with
   end if

' Message generated in Application log of Event Viewer:
'  "State transition error: Error in action: I'm testing this..."


Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.