Getting specific error message from C++ catch()
Posted on 2004-11-28
I'm trying to catch a meaningful error message when an exception is thrown.
When the exception is caught by MFC TRY-CATCH statement, I can retrieve an error message with not problem.
But when it's thrown by non-MFC code, that's when I have the problem.
The reason I'm trying to get a specific error message is because when my code interfaces with a third party DLL, it throws an exception.
Since I have no documents for the DLL, I'm not sure what it's throwing, and it's not being caught by the MFC CATCH_ALL block.
How can I get details of the object being thrown on a C++ catch() statement?
This code is an example of an exception that is not caught by MFC CATCH_ALL.
char* s = NULL;
int* p = NULL;
s = new char;
*p = 5;
printf("Got Unknown error\n");