MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 16: Errors


 

ERRORINFO Structure

The ERRORINFO structure returns most of the basic information associated with an error:

typedef struct tagERRORINFO {
   HRESULT   hrError;
   DWORD     dwMinor;
   CLSID     clsid;
   IID       iid;
   DISPID    dispid;
} ERRORINFO;

The elements of this structure are used as described in the following table.

Element Description
hrError The code returned by the method. This might be different in different records in the error object. For example, suppose a query processor service component opens rowsets provided by base table data providers. If ICommand::Execute in the query processor calls IOpenRowset::OpenRowset in a base table data provider and OpenRowset fails with DB_E_NOTABLE, Execute might return DB_E_ERRORSINCOMMAND.
dwMinor A provider-specific error code.
clsid The class ID of the object that returned the error.
iid The interface ID of the interface that generated the error. The value of iid can be different from the ID of the interface that defines the method the consumer called. For example, if a consumer calls If ICommand::Execute in a query processor and if the query processor then calls IOpenRowset::OpenRowset in a base table data provider and OpenRowset fails, iid is IID_IOPENROWSET, not IID_ICOMMAND.

If the method that generates an error belongs to more than one interface because of inheritance, this value is the ID of the first interface in which the method is defined. For example, suppose IRowsetLocate::GetRowsAt is called through a pointer to IRowsetScroll, which inherits from IRowsetLocate. If GetRowsAt fails, iid is IID_IROWSETLOCATE, not IID_IROWSETSCROLL.

dispid Optional and provider-specific. Could be used, for example, to indicate the method that returned the error.