TraceError

Description

Logs your own error message and its severity level to the trace file if tracing of this activity type has been enabled.

Syntax

TraceError ( severity, message )

Argument

Description

severity

A long whose value is a number you want to indicate the severity of the error

message

A string whose value is the error message you want to add to the trace file

Returns

ErrorReturn. This function always returns Success!.

If severity or message is null, TraceError returns null and no entry is made in the trace file.

Usage

TraceError logs an activity type value of ActError! to the trace file if you enabled the tracing of this type with the TraceEnableActivity function and then called the TraceBegin function. You use the TraceError function to record your own error message. It works just like the TraceUser function except that you use it to identify more severe problems. The severity and message values are passed without modification to the trace file.

Examples

Example 1

This example logs an error message to the trace file when a database retrieval fails:

dw_1.SetTransObject(SQLCA)


TraceUser(100, "Starting database retrieval")

IF dw_1.Retrieve() = -1 THEN

      TraceError(999, "Retrieve for dw_1 failed")

ELSE

      TraceUser(200, "Database retrieval complete")

END IF

See also