I have browsed a little more and found something of a good use.
My question could be rephrased: How do I resurrect an unhandled exception.
Here is a solution:
// resurrect gone exception here
std::string ResurrectException()
{
try
{
throw;
}
catch (const std::exception& e)
{
return e.what();
}
catch (int intEx)
{
char buffer[2];
sprintf(buffer,"%d",intEx);
std::string outStr = buffer;
return buffer;
}
catch (std::string strEx)
{
return strEx;
}
catch (char * buffEx)
{
std::string outStr = buffEx;
return outStr;
}
// } catch (my_custom_exception_type& e) {
// return e.ToString(); }
catch(...)
{
return "unknown exception!";
}
}
See here for details
I just wonder about the part "get the stack of the place where the exception was thrown". In C# standard System.Exception class carries information about stack as a string member. Unfortunatelly I don't see this in C++ standard system exceptions.