Each class that wants to use error handling must inherit from CErrorHandler.
In it's constructor set the class name, using: CErrorHandler::SetName.
We offer a few macros for each kind of scenario: (the macros are define at file ErrorHandlerMacros.h)
ERROR_HANDLER - The most basic handler, just reports the error.
ERROR_HANDLER_RETURN - Reports the error, and returns a value.
ERROR_HANDLER_STATIC - Reports an error within a static or global function.
ERROR_HANDLER_STATIC_RETURN - Reports an error within a static or global function, and returns a value.
Examples:
ERROR_HANDLER
void MyClass::RegularHandler()
{
try
{
//Do some code
}
ERROR_HANDLER("RegularHandler")
}
ERROR_HANDLER_RETURN
BOOL MyClass::ReturnHandler()
{
try
{
//Do some code
return TRUE;
}
ERROR_HANDLER_RETURN("ReturnHandler",FALSE)
}
ERROR_HANDLER_STATIC
method is declared static
void MyClass::StaticHandler()
{
try
{
//Do some code
}
ERROR_HANDLER_STATIC("MyClass","StaticHandler")
}
ERROR_HANDLER_STATIC_RETURN
method is declared static
BOOL MyClass::StaticReturnHandler()
{
try
{
//Do some code
return TRUE;
}
ERROR_HANDLER_RETURN("MyClass","StaticReturnHandler",FALSE)
}