RoCaptureErrorContext function (roerrorapi.h)

Saves the current error context so that it's available for later calls to the RoFailFastWithErrorContext function.

Syntax

HRESULT RoCaptureErrorContext(
  HRESULT hr
);

Parameters

hr

The HRESULT associated with the error.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The RoCaptureErrorContext function captures the context associated with an error, including the stack-backtrace. This information is stored in the restricted error object and is available to the Windows Error Reporting (WER) service, if WER is enabled, and if a subsequent call is made to the RoFailFastWithErrorContext function from the same thread.

To use RoCaptureErrorContext function with RoOriginateError, call RoOriginateError first, and then call RoCaptureErrorContext. Calling in the reverse order may cause the error context to be lost.

Requirements

   
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header roerrorapi.h
Library RuntimeObject.lib
DLL ComBase.dll

See also

IRestrictedErrorInfo

RoFailFastWithErrorContext

RoOriginateError

RoOriginateErrorW