support_error_info

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

Implements support for returning detailed errors.

  
      [ support_error_info(  
   error_interface=uuid  
) ]  

Parameters

error_interface
The identifier of the interface implementing IErrorInfo.

The support_error_info C++ attribute implements support for returning detailed, contextual errors encountered by the target object to the client. For the object to support errors, the methods of the IErrorInfo interface must be implemented by the object. For more information, see Supporting IDispatch and IErrorInfo.

This attribute adds the ISupportErrorInfoImpl class as a base class to the target object. This results in a default implementation of ISupportErrorInfo and can be used when a single interface generates errors on an object.

The following code adds default support for the ISupportErrorInfo interface to the CMyClass object.

// cpp_attr_ref_support_error_info.cpp  
// compile with: /LD  
#define _ATL_ATTRIBUTES  
#include "atlbase.h"  
#include "atlcom.h"  
  
[module (name="mymod")];  
[object, uuid("f0b17d66-dc6e-4662-baaf-76758e09c878")]  
__interface IMyErrors  
{  
};  
  
[ coclass, support_error_info("IMyErrors"),  
  uuid("854dd392-bdc7-4781-8667-8757936f2a4f") ]  
class CMyClass  
{  
};  

Attribute Context

Applies toclass
RepeatableYes
Required attributesNone
Invalid attributesNone

For more information about the attribute contexts, see Attribute Contexts.

COM Attributes
Class Attributes
Attributes Samples

Show: