IErrorLookup

IErrorLookup is used by OLE DB error objects to determine the values of the error message, source, Help file path, and context ID based on the return code and a provider-specific error number.

IErrorLookup is exposed by a provider-specific error lookup service that is mandatory for all providers that return OLE DB error objects.

When to Implement

All providers that return OLE DB error objects must implement IErrorLookup in a separate lookup service. For information about the registry entries used by error lookup services, see "Error Lookup Service Registry Entries" in Chapter 14.

When to Call

IErrorLookup is called by the code shipped in the OLE DB SDK that implements OLE DB error objects. It should not be called by general consumers.

When an error occurs, the following sequence of events takes place:

  1. The provider creates an OLE DB error object and adds a record to that object.

  2. The consumer retrieves the error object and gets an IErrorInfo interface on a particular record in that object. It then calls a method in IErrorInfo.

  3. Except for the IErrorInfo::GetGUID method, the OLE DB error object code, which is shipped with the OLE DB SDK, loads the error lookup service based on the class ID stored in the error record.

  4. The OLE DB error object code returns the hrError element of the ERRORINFO structure, the lookup ID, and the error parameters from the error record. It also returns the locale ID requested in IErrorRecords::GetErrorInfo. It passes all of this information to the appropriate IErrorLookup method.

  5. The IErrorLookup method returns the requested information, based on the hrError, dwLookupID, and lcid arguments, integrates the parameters, and returns this to the error object code.

  6. The OLE DB error object code returns the requested information to the consumer.

  7. The consumer releases the OLE DB error object.

  8. The OLE DB error object code calls IErrorLookup::ReleaseErrors for all error records with a nonzero dynamic error ID to release the error information associated with that record.
Method Description
GetErrorDescription Returns the error message and source, based on the return code and the provider-specific error number.
GetHelpInfo Returns the path of the Help file and the context ID of the topic that explains the error.
ReleaseErrors Releases any dynamic error information associated with a dynamic error ID.