In the release version of my code one line is throwing an exception and I don't know what type of exception it is so I can't catch it correctly or figure out the problem.
I using the catch(...) but that's pretty much worthless.
here is some pseudo code
try
{
m_mmwIPC = gcnew NiftyIPC(gcnew String("Monitor"), true);
}
catch (CException* e)
{
TCHAR szCause[255];
e->GetErrorMessage(szCause, 255);
CString errorStr = szCause;
RemoveLineFeeds(errorStr);
OutputDebugString(errorStr);
}
catch(...)
{
OutputDebugString(L"Unknown exception\n");
}
So, is there any way to get any details on the thrown unknown exception? Just a type would be great.
thanks
Not really, it could be an int
, a const char*
or a RhubarbPie
über-smart pointer.
However:
std::exception
too. That will catch a lot of C++ native exceptions.As you specify the use of MFC, then I will make the assumption that you're working with a version of Visual Studio. If this is the case and you are able to run your program in debug mode, then you can set the debugger to break on unhandled exceptions. This would require removing the catch(...)
part of your code, but it should break into the debugger at the correct point, and provide you with useful information on the exception itself.
I refer you to the Microsoft documentation here and here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With