Table of Contents

IErrorTrace

Namespace
ZCore
INTERFACE IErrorTrace

This interface is used for recording and navigating through an error stack. In Zeugwerk-Framework any object that is State=Error holds a reference to the object that caused the error for this object. This information is used to recursively find the culprit. The errortrace of an object can be recorded by calling TraceErrorStack. The simplest way to visualize a trace is by using the Record method. It is also possible to manually return the messages by using the methods provided by the error-trace interface.

Properties

Size

PROPERTY Size : DINT

Actual size of the error trace

Property Value

DINT

Methods

AddErrorMessage

METHOD AddErrorMessage (
 [inout] message : ZString)

This method is used by TraceErrorStack to add an error message to the trace. Usually this method is only called by the culprit of the root cause of an error.

InOuts

message ZString

AddInstance

METHOD AddInstance (
 [inout] classname : ZString,
 [inout] instancename : ZString)

This method is used by TraceErrorStack to add an individual object instance to the trace.

InOuts

classname ZString
instancename ZString

Clear

METHOD Clear ()

This method should be called everytime before recording an error trace to delete old entries from the stack.

Item

METHOD Item (
 [input] idx : DINT) : REFERENCE TO ZString

Retrieve an object from the error stack. The variable idx should be between 0 and Size-1. The return of this method is an invalid reference if the index is not within the valid range.

Inputs

idx DINT

Returns

REFERENCE TO ZString

Record

METHOD Record (
 [input] root : IError,
 [input] logger : ILogger,
 [input] logLevel : LogLevel)

This method is used to write an error trace of the passed root object into a logger.

Inputs

root IError
logger ILogger
logLevel LogLevel