Setup an Error Callback

An error callback can be set through the RED::IResourceManager interface:

// Access the resource manager:
RED::Object* resmgr = RED::Factory::CreateInstance( CID_REDResourceManager );
if( resmgr )
{
    RED::IResourceManager* iresmgr = resmgr->As< RED::IResourceManager >();
    RC_TEST( iresmgr->SetErrorCallback( MyErrorCallback, NULL ) );
}

Whenever an error gets raised by HOOPS Luminate, the callback gets called with all the available informations:

  1. The return code identifying the error in the first place.

  2. The calling method or function; This will point to internal HOOPS Luminate method names, but this can still provide valuable informations, and this can be also very useful to transmit this information to the HOOPS Luminate support.

  3. A relevant object address. This can point to an internal HOOPS Luminate object, or to a user object address, which was involved in raising the error.

  4. An extra expression field, that can contain a string value with the failing expression (generally used for 3rd party API calls such as OpenGL).

  5. An extra information field that can help diagnosing the error source.

  6. Extra user data that can be setup using RED::IResourceManager::SetErrorCallback.