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 REDsdk, the callback gets called with all the available informations:
- The return code identifying the error in the first place.
- The calling method or function; This will point to internal REDsdk method names, but this can still provide valuable informations, and this can be also very useful to transmit this information to the REDsdk support.
- A relevant object address. This can point to an internal REDsdk object, or to a user object address, which was involved in raising the error.
- An extra expression field, that can contain a string value with the failing expression (generally used for 3rd party API calls such as OpenGL).
- An extra information field that can help diagnosing the error source.
- Extra user data that can be setup using RED::IResourceManager::SetErrorCallback.
![]() | Creating a REDsdk window using the RED::Factory![]() |