OnLogError Event

Applies to TestComplete 14.30, last modified on November 21, 2019

Occurs before an error message is posted to the test log.

Declaration

OnLogError(SenderLogParams) Parameters
Sender [in] Required Variant
LogParams [in] Required A LogParams object

Description

The event occurs before an error message is posted to the test log. You can use this event to perform desired actions when an error message is posted to the log. For instance, TestComplete posts an error message when an error occurs during script execution.

Parameters

The event has the following parameters:

Sender

The Event control that processes the event.

LogParams

The properties of the LogParams object hold node attributes. You can use the LogParams.MessageText property to replace the TestComplete text with your own.

To avoid recurring calls, do not use the Log.Error method within the event handler of the OnLogError event.

Remarks

The OnLogError event is only generated for error messages caused by errors that occur during calls to methods of TestComplete program objects. For example, this event is raised when you call Log.Error to post the error message manually, or when an error occurs because of a call to Sys.Process to obtain the process object which currently does not exist in the system.

The OnLogError event is not raised for error messages caused by exceptions. Exceptions can occur in the application under test and also can occur due to errors in the script code. For example, the event is not raised by “The … process crashed” error messages posted to the test log. For information on how to handle these exceptions, see Handling Exceptions in Scripts.

For information on how to create an event handler for this and other TestComplete events, see Handling Events.

Do not call the Run method of the NetworkSuite, Job and Task objects from the event handler. Otherwise, an error will occur.

In addition, do not call the NetworkSuite.Synchronize method from the event handler. The method will always return False.

See Also

Posting Messages to the Log
LogParams Object
OnLogMessage Event
OnLogWarning Event
OnLogEvent Event
OnLogCheckpoint Event
OnLogPicture Event
OnLogFile Event
OnLogLink Event
Handling Events
Event Control

Highlight search results