in my code, I wrote my own exception handler and with a macro, I can issue a message containing the file and line of code where the exception was thrown.
Code: Select all
#define THROW_DBT_EXCEPTION( s ) throw DBT_Exception( __FILE__,__LINE__,__FUNCSIG__, s )
For example, recently, I had a std::exception issued by the STD lib, just writting "string too long".
Argh.... did not even know where the error was in the code...
At the end of my main, I have this :
Code: Select all
catch (const DBT_Exception& e)
{
MessageBoxA(nullptr, e.what(), "DBT Error", MB_ICONERROR);
}
catch (const std::exception& e)
{
MessageBoxA(nullptr, e.what(), "STD Error", MB_ICONERROR);
}
catch (...)
{
MessageBoxA(nullptr, "Unhandled exception...", "Error", MB_ICONERROR);
}
So, how am I supposed to "smartly" handle STD exception, so that in the final "release" given to the user (non debug), I can still log this kind of error and still record a clue on where it was thrown...