Share via


Error List Example Using C++

The following code example shows how error lists are typically used.

CWTTLogger.AddErrorToErrorList(
   E_ACCESSDENIED,
   WTT_ERROR_TYPE_HRESULT,
   WTT_ERROR_LIST_EXPECTED
);

CWTTLogger.CheckResult(
   E_ACCESSDENIED,
   WTT_ERROR_TYPE_HRESULT,
   __WFILE__,
   __LINE__,
   L"This should pass, and does not log",
   NULL
);

CWTTLogger.RemoveErrorFromErrorList(
   E_ACCESSDENIED,
   WTT_ERROR_TYPE_HRESULT,
   WTT_ERROR_LIST_EXPECTED
);

CWTTLogger.CheckResult(
   E_ACCESSDENIED,
   WTT_ERROR_TYPE_HRESULT,
   __WFILE__,
   __LINE__,
   L"This should fail, and it should log",
   NULL
);

When the CWTTLogger::CheckResult method is first called, E_ACCESSDENIED is considered a valid error code, and DTM Logger logs nothing. However, on the second call to CWTTLogger::CheckResult, E_ACCESSDENIED is logged as a failure because it is not in the known error list.

See Also

Code Samples for DTM Logger, Using Error Lists

Send feedback on this topic
Built on December 10, 2009